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

Re: Last call

This page is part of the web mail archives of SRFI 106 from before July 7th, 2015. The new archives for SRFI 106 contain all messages, not just those from before July 7th, 2015.



On 06/30/2013 10:46 AM, Takashi Kato wrote:
On 30/06/2013 19:19, Per Bothner wrote:
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.  An "input/output port" is not a sequence -
it is two sequences, along with two positions.
Probably (or most definitely) I have different opinion about this so I
simply don't understand the point. Here is my understanding and
objection break down;

  * If a "port" is a sequence, then it can be represented by a list (say
list-port)
  * "list-port" has a position.
  * When reader reads from "list-port", then the position will be
increased.
  * Then writer writes (in this case appends) to "list-port", it writes
after the above position.

But the write also increases the position.  Which means that a subsequent
read will skip ahead.

  * Position change operation changes the position.

True, you can have a "read/modify/write port" but these are closer
to array semantics: There is a single sequence of values, and a
single position.  You normally don't do sequential reads/writes.
If you do it's more likely to be: seek; peek; either skip or replace.
It's not clear such objects are "ports" - they're more like an array.

Regardless, for a socket port there isn't a single sequence of values.
If you write to the output side, those bytes do not show up on the
input side.  If you read from the input sequence, that does not change
the current position on the output sequence, and vice versa.

This might not be the case for a "socket port" so that socket has real bidirectional IO.

Right: A "socket port" is not  a port; it's two ports.
--
	--Per Bothner
per@xxxxxxxxxxx   http://per.bothner.com/