TCP library

Pascal Serrarens pascalrs@cs.kun.nl
Mon, 08 Feb 1999 11:27:50 +0100


Martin Wierich wrote:

          # channel1               = fwrites "hallo wereld\n" channel1
            (halloWereld,channel2) = freadline channel2
          = (halloWereld,channel2,channel1)

Richard A. O'Keefe wrote:

> Martin Wierich's point about two-way communication is a valid
> observation about the trickiness of trying to co-ordinate two separate
> end-points in a lazy language; a compelling argument using for a *single*
> bidirectional channel with 'receive' rightly seen as a mutating operator,
> rather than having separate endpoints.

I do no think you got Martin point. In his code example he was talking
about two different channels (files/pipes). One of these was used to 
receive/read data on, the other to send/write data. So we could have three
programs: a producer, our program and a consumer.

   producer -> our program -> consumer

> 4.  Interacting with another program (whether remotely through a
>     network or locally through message queues or whatever) requires
>     destructive reads and writes to be synchronised, and that appears
>     to be easiest when a _single_ Clean value is used for both
>     directions of communication.

Yes, that is true. But quite often you also want indepence between
reads/receives and write/sends and that is the hardest with one single
value. This is one of the reasons we chose to have separate send/write and
read/receive endpoints.

However, we are also working on a bi-directional wrapper channel which
combines the send and receive sides of a channel. It is still quite
premature, but I think it is just what you want.

We are still working on the other points.

Pascal Serrarens.