Readline problem, interactive newlisp?

Started by TedWalther, October 12, 2010, 09:07:36 AM

Previous topic - Next topic

TedWalther

In newlisp, I notice that the prompt doesn't always reappear after I press Enter.  I have to press enter a second time.  Try it; start up newlisp, and hit enter at the prompt.



Now, if I type (println)[enter], the prompt comes back right away.
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence.  Nine months later, they left with a baby named newLISP.  The women of the ivory towers wept and wailed.  \"Abomination!\" they cried.

cormullion

#1
Does it happen with:


newlisp -n

Lutz

#2
This is the new multi-line entry feature, I talked about this morning (bottom part of the post):



http://newlispfanclub.alh.net/forum/viewtopic.php?f=16&t=3726&p=18710#p18710">http://newlispfanclub.alh.net/forum/vie ... 710#p18710">http://newlispfanclub.alh.net/forum/viewtopic.php?f=16&t=3726&p=18710#p18710



Also here in the manual of 10.2.16



http://www.newlisp.org/downloads/development/newlisp_manual.html#multiline">http://www.newlisp.org/downloads/develo ... #multiline">http://www.newlisp.org/downloads/development/newlisp_manual.html#multiline



and also here in the 5th bullet



http://www.newlisp.org/downloads/development/newLISP-10.3-Release.html">http://www.newlisp.org/downloads/develo ... lease.html">http://www.newlisp.org/downloads/development/newLISP-10.3-Release.html

cormullion

#3
Ah, sorry, my mistake. I hadn't realised it worked this way, and I haven't downloaded it yet. I thought it only went multi-line when it was above level 0 (ie until initial  parenthesis is matched).

TedWalther

#4
Thanks, that clears up the mystery.  Is there a reason that multiline isn't the default, without having to type a blank line first?
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence.  Nine months later, they left with a baby named newLISP.  The women of the ivory towers wept and wailed.  \"Abomination!\" they cried.

Lutz

#5
This multiline mode doesn't count parentheses, you have to switch in and out. For efficiency reason reading source and parsing source are not intertwined as in traditional LISP interpreters, but they are separated to make the reading process as fast as possible for 'net-eval' on the server side. You want to bring the source as fast as possible over the wire in one big piece before parsing it. The new multiline mode leverages the existing code for multiline operation using the [cmd],[/cmd] tags which was already in newLISP and is used by 'net-eval'. The empty lines basically work as a replacement for those tags.

TedWalther

#6
Would it be fairly involved for the interpreter shell to submit each line to the underlying parsing code as it is received, and only evaluate up to the last complete symbol or balanced paren?  I mean, the parser already takes care of this in non-interactive mode, right?  Or does the readline stuff make it too messy?
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence.  Nine months later, they left with a baby named newLISP.  The women of the ivory towers wept and wailed.  \"Abomination!\" they cried.

Lutz

#7
The point is, to do I/O on the entire multiline text, then parse and evaluate the entire chunk expression by expression in a second step. I am trying to leverage the multiline code based on the [cmd], [/cmd] tags used by 'net-eval' and which is designed for speed. I don't want to implement and entirely new multiline handling just for the interactive terminal.