[r6rs-discuss] [Formal] need make-custom-textual-input-port and make-custom-textual-output-port

From: John Cowan <cowan>
Date: Wed Mar 21 14:01:56 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.
>
> Why?

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
again?

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.'
        --the Bi-Coloured-Python-Rock-Snake
Received on Wed Mar 21 2007 - 14:01:47 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC