This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Prompt on read
- From: Helmut Eller <eller dot helmut at gmail dot com>
- To: kawa at sourceware dot org
- Date: Wed, 22 Nov 2017 00:31:08 +0100
- Subject: Re: Prompt on read
- Authentication-results: sourceware.org; auth=none
- References: <m2zi7f3ach.fsf@caladan> <b9109562-725d-0410-fa04-7326faca91b8@bothner.com>
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