(import (rnrs)) (let*-values (((port extract) (open-bytevector-output-port)) ((out) (transcoded-port port (native-transcoder)))) (put-string out "hello") (display (extract)))What do you think the
(extract)should do? According to the R6RS spec of
transcoded-portthe port must be closed by special way so that other string operations can be done.
As a side effect, however, transcoded-port closes binary-port in a special way that allows the new textual port to continue to use the byte source or sink represented by binary-port, even though binary-port itself is closed and cannot be used by the input and output operations described in this chapter.I know
-- R6RS Standard libraries 8.2.6 Input and output ports
open-bytevector-output-portcan take a transcoder as its optional argument, however I think there is needs that the created bytevector output port needs to be converted later for some reason or user wants to store first pure binary data then some text data.
Now I've tried what the implementations would return, the result was rather interesting. Followings are the tested implementations and its result;
[Implementations that raised an error]
- Larceny 0.97
- Racket 5.2.1
- Sagittarius 0.4.11
- Ypsilon 0.9.6-update3
- Mosh 0.2.7
- Petite Chez Scheme 8.4
Hmmmm, what should I do?