[r6rs-discuss] [Formal] need make-custom-textual-input-port and
cowan at ccil.org
Wed Mar 21 14:01:47 EDT 2007
Michael Sperber scripsit:
> Per Bothner <per at bothner.com> writes:
> > I guess in theory one might be able to wrap a transcoder around a
> > custom binary port but that seems horribly wrong when there is no
> > underlying byte stream.
Because it presumes that the only sensible source of characters is
either a string or a underlying source of bytes (and ditto for sinks).
But this is not so. For example, I might have a (stateful) procedure
that picks a random letter from a given text represented as a string.
Surely it's more reasonable to wrap the procedure directly with
make-custom-textual-input-port rather than following the above two-step
procedure, with its conversion from characters to bytes to characters
The same arguments apply for m-c-t-output-port and
m-c-t-input/output-port, of course. I presume that vectors of characters
should stand in for bytevectors in in the read! and write! procedures,
though strings might be a workable alternative.
John Cowan http://ccil.org/~cowan cowan at ccil.org
'My young friend, if you do not now, immediately and instantly, pull
as hard as ever you can, it is my opinion that your acquaintance in the
large-pattern leather ulster' (and by this he meant the Crocodile) 'will
jerk you into yonder limpid stream before you can say Jack Robinson.'
More information about the r6rs-discuss