Prompt on read
Helmut Eller
eller.helmut@gmail.com
Tue Nov 21 23:31:00 GMT 2017
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
More information about the Kawa
mailing list