Discussion:
[Larceny-users] (newline port) in err5rs mode
Jon Wells
2011-02-27 08:25:26 UTC
Permalink
I guess it's me this doesn't seem right but...

***@pow 68% larceny -path . -err5rs
Larceny v0.97 "Funny in the Head" (Aug 19 2009 06:31:24,
precise:Linux:unified)
larceny.heap, built on Wed Aug 19 06:33:35 EDT 2009
ERR5RS mode (no libraries have been imported)
(import (rnrs))
(newline (standard-error-port))
Error: put-char: not an output port #<OUTPUT PORT
*error-output*>
Entering debugger; type "?" for help.
debug> #<EOF>

while
(display "stuff" (standard-error-port))
stuff


jon.
w***@ccs.neu.edu
2011-02-28 01:11:35 UTC
Permalink
Post by Jon Wells
I guess it's me this doesn't seem right but...
Larceny v0.97 "Funny in the Head" (Aug 19 2009 06:31:24,
precise:Linux:unified)
larceny.heap, built on Wed Aug 19 06:33:35 EDT 2009
ERR5RS mode (no libraries have been imported)
(import (rnrs))
(newline (standard-error-port))
Error: put-char: not an output port #<OUTPUT PORT
*error-output*>
Entering debugger; type "?" for help.
debug> #<EOF>
while
(display "stuff" (standard-error-port))
stuff
Good catch. Neither newline nor display nor put-char should
work with (standard-error-port), which the R6RS requires to be
a "fresh binary output port". I suspect that the usefulness
of display with (standard-error-port) was a transitional matter
to help with the transition to R6RS i/o semantics. With that
transition complete, all textual output operations should raise
exceptions when used with a (standard-error-port) or
(standard-output-port).

The error message was misleading as well. I'll log both bugs
tomorrow.

The portable way to write text to a (standard-output-port) or
(standard-error-port) is to use the transcoded-port procedure
Post by Jon Wells
(define p (transcoded-port (standard-error-port) (native-transcoder)))
(newline p)
Will
David Rush
2011-02-28 10:05:44 UTC
Permalink
Post by w***@ccs.neu.edu
The portable way to write text to a (standard-output-port) or
(standard-error-port) is to use the transcoded-port procedure
Post by Jon Wells
(define p (transcoded-port (standard-error-port) (native-transcoder)))
(newline p)
presumably CURRENT-OUTPUT-PORT and CURRENT-ERROR-PORT work as in R5?

david
--
GPG Public key at http://cyber-rush.org/drr/gpg-public-key.txt
William D Clinger
2011-02-28 21:31:58 UTC
Permalink
Post by David Rush
presumably CURRENT-OUTPUT-PORT and CURRENT-ERROR-PORT work as in R5?
Yes, but the R5RS doesn't say much about either. In fact, the R5RS
doesn't even mention a current-error-port procedure.

The R6RS requires both (current-output-port) and (current-error-port)
to "return default textual ports". It also says that these ports are
"normally" "associated with standard output, and standard error,
respectively", presumably via some implementation-dependent use of
the transcoded-port procedure or something analogous as illustrated
in my previous message.

Will

Loading...