This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Prompt on read


On Tue, Nov 21 2017, Per Bothner wrote:

>> Despite that the prompt in line two is confusing, the line number in the
>> third prompt seems wrong.  I would expect that read works basically like
>> read-line,
>
> Yes and no.  read reads an S-expression, and there may be a many-to-many
> relationship between S-expressions and lines.  A prompt is printed before
> each input line -

If a prompt is printed before each input line, then why does calling
read-line not print a prompt? 

> however note it is possible for a procedure to change the
> prompt, for example to the empty string.

You mean something like (fluid-let ((input-prompt1 "")) ...)  or
something else?  Hmm, that would work for me.

> FWIW I can't come up with any valid use-case for explicitly calling
> read on an interactive port.  The problem is error recovery.
> Enlighten me.

Uhm, a REPL that wants to print its own prompt?  Or something like

(format #t "Please enter a filename: ")
(open-output-file (read))

Helmut


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]