[Openmcl-devel] FORCE-OUTPUT in (STREAM-READ-LINE ECHOING-TWO-WAY-STREAM)
gb at clozure.com
Mon Sep 13 15:47:28 UTC 2010
(For anyone curious: an ECHOING-TWO-WAY-STREAM is just a TWO-WAY-STREAM
on which input on the input side is presumed to echo on the output side,
so (e.g.) reading a #\Newline causes subsequent output to start in column
0 and things like FRESH-LINE are less likely to output extra newlines.
Despite the name, an ECHOING-TWO-WAY-STREAM isn't an ECHO-STREAM.)
That said ... yes, STREAM-READ-LINE should probably do a FORCE-OUTPUT.
The general idea is that input from the input side may have been preceded
by output (a prompt) on the output side, and forcing output will help
to ensure that the prompt is visible in that case. Calling FORCE-OUTPUT
in that case should be harmless at worst.
Output streams can register themselves to automatically flushed (to
have FORCE-OUTPUT called on them a few times each second). This
mechanism doesn't seem to be documented, though it's fairly simple and
is intended to be visible, and it's used on the output side of
*TERMINAL-IO* in CCL. SLIME started using a similar mechanism some
time ago, so the cases where ECHOING-TWO-WAY-STREAMs need try to
ensure that "the prompt is visible" aren't as numerous or visible
as they once were, but it doesn't hurt much to do that and might help.
On Sun, 12 Sep 2010, Scott L. Burson wrote:
> If you look in level-1/l1-streams.lisp, you will find two methods on
> ECHOING-TWO-WAY-STREAM, STREAM-READ-CHAR and STREAM-READ-LINE.
> STREAM-READ-CHAR includes a FORCE-OUTPUT call on the output stream;
> STREAM-READ-LINE does not. Adding it fixes a bug in my app, though
> the complete causal chain underlying the bug is not clear; I can't see
> how to reproduce the bug in a bare CCL. But maybe the FORCE-OUTPUT is
> sufficiently benign to be added to the official sources anyway?
> -- Scott
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
More information about the Openmcl-devel