[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Bidirectional ports and port-open?

On 07/01/2012 05:01 PM, John Cowan wrote:
> Per Bothner scripsit:
>> An true bi-directional port is one where you can read a "record",
>> modify it, and write it back.  If the port is seekable, the input
>> and output positions are tied.
> I don't see how these can both be true unless the port is indeed
> seekable.  If I read, modify, and then write, the write goes after the
> point read from unless I first seek back to before the read.

There can be an API that supports read-modify-write.  But that again
would require non-standard extensions.  A true bi-directional port
is indeed likely to be seekable, like Java's RandomAccessFile.

Regardless, I contend the concept of a port where "it is useful to close
the input and output sides separately" is bogus.  What people are really
talking about is a "connection" (for example a socket object) which is a
different kind of object that has two *separate* ports, usually in addition
to other state.
	--Per Bothner
per@x   http://per.bothner.com/

Scheme-reports mailing list