[R6RS] Changing the transcoding mid-stream

Michael Sperber sperber at informatik.uni-tuebingen.de
Wed Aug 23 13:13:35 EDT 2006


dyb at cs.indiana.edu writes:

> Good points.  This raises a question: If a call to lookahead-u8 returns
> eof, and the next operation on the port is a call to get-u8 or
> lookahead-u8, can the second call return something other than eof if the
> underlying file (or whatever) has been extended in the meantime?

No.  The EOF is part of the data stream, or at least that was the
intention.

> Is port-eof? just (lambda (port) (eof-object? (lookahead-u8 port)))?

Yes.

> clear-input-port discards any buffered input; there's no where to flush
> it to.  It's useful in error handlers when reading input from the user
> to avoid mistaking earlier typeahead for an answer to a query.

I think using this type of low-level functionality from a portable
error handler will likely not get the desired result on all platforms,
especially those that do their own buffering underneath.

> Mike, if this wasn't an oversight that should simply be fixed by replacing
> call-with-whatever-output-port with open-whatever-output-port, can you
> explain the rationale?  Assuming there is a rationale, why doesn't it
> apply to the input versions?  Why doesn't it it apply to the file opener?
> Is there some reason that call-with-port won't suffice to handle all
> "call-with" situations?

Yes.  How do you get at the accumulated output?

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla



More information about the R6RS mailing list