[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Last call
Per Bothner scripsit:
> What is a binary input/output port? There is no such thing in R7RS.
Well, there is no way to create one, but their potential existence is
allowed for. In particular, the opening paragraph of 6.13.1 says
Whether the input and output port types are disjoint is
What is more, the discussion of `close-port` and friends says explicitly:
Scheme implementations may provide ports which are simultaneously
input and output ports, such as sockets; the close-input-port
and close-output-port procedures can then be used to close the
input and output sides of the port independently.
Common Lisp already has the functions `make-two-way-stream` and
`make-echo-stream` to achieve this at the Lisp level, so you will have
to solve the problem eventually.
And speaking of `make-echo-stream`:
> No, the issue is not Java, but what a "port" conceptually is
> (or should be): A "port" is a sequence of values, along with a current
> position in that sequence.
The trouble with that definition is that the position isn't necessarily
reifiable. A TTY can be seen as one stream or two, but in neither case
does it make sense to ask "What is the value of the position?" Instead,
I think it makes sense to think of a port as a (SRFI 41) stream (which in
fact is the terminology of CL): a lazy sequence (or cosequence) of values.
In some cases it's possible to rewind the stream to an earlier point,
in other cases not.
A rose by any other name John Cowan
may smell as sweet, http://www.ccil.org/~cowan
but if you called it an onion cowan@xxxxxxxx
you'd get cooks very confused. --RMS