Readline problem, interactive newlisp?

Q&A's, tips, howto's
Locked
TedWalther
Posts: 608
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Readline problem, interactive newlisp?

Post by 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
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Re: Readline problem, interactive newlisp?

Post by cormullion »

Does it happen with:

Code: Select all

newlisp -n

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: Readline problem, interactive newlisp?

Post by Lutz »

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

http://newlispfanclub.alh.net/forum/vie ... 710#p18710

Also here in the manual of 10.2.16

http://www.newlisp.org/downloads/develo ... #multiline

and also here in the 5th bullet

http://www.newlisp.org/downloads/develo ... lease.html

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Re: Readline problem, interactive newlisp?

Post by cormullion »

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
Posts: 608
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Re: Readline problem, interactive newlisp?

Post by TedWalther »

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
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: Readline problem, interactive newlisp?

Post by Lutz »

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
Posts: 608
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Re: Readline problem, interactive newlisp?

Post by TedWalther »

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
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: Readline problem, interactive newlisp?

Post by Lutz »

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.

Locked