Catching up on some old mail:

    Date:         Sun, 6 Sep 1992 20:06:13 +0100
    From: sinclair <[EMAIL PROTECTED]>
 
    Say I'm reading from a couple of "channels" using "ReadChannels",
    how do I when I get eof on one them?
 
    Case in point:  Using hbc, I'm reading from stdio, but also using a
    "TICK", to keep a clock upto date.  When I hit ^D, I would like the
    program to be able to detect this, and terminate.
 
    Currently, there seems to be a mis-bug in hbc which means I get a never
    ending stream of "-1" characters, which is at least better than nothing
    at all.
 
    Am I missing something?
 
    Duncan Sinclair                    |  Try one    [EMAIL PROTECTED]
    Computing Science Research Student |  of these:  [EMAIL PROTECTED]
    University of Glasgow              |..!mcsun!ukc!uk.ac.glasgow.dcs!sinclair

  Date:         Sun, 6 Sep 1992 23:51:14 +0200
  From: Lennart Augustsson

  As far as I can tell there is no way to detect EOF with ReadChannels.
  Maybe you should ask the designer (Paul Hudak) of this language feature
  how to do it.

  The endless stream of -1 with hbc is definitely a kind of bug.  I'll fix it.

For "ReadChan" the answer is obvious: end-of-channel corresponds to
the end-of-list.  ReadChannels, unfortunately, never got much thought,
since it only appears as an "Optional Request" in the Appendix.  I'm
surprised (but glad) that someone (Lennart) bothered to implement it.

For those not familiar with ReadChannels, the intent was to provide a
way to perform the non-deterministic merge of several input channels.
This required "tagging" the individual characters, but then there's no
convenient way to mark the end of a particular channel.  I don't know
what the correct behavior should be.  Perhaps the ^D that the user
types, at least in the case of stdio, should be sent along the channel?  
That would seem to be the simplest fix for now, and I assume is what
Lennart is planning to do.  A more drastic fix would be to introduce
a special end-of-channel marker, but then we'd have to inject the
characters into a union type.  I suggest we use the former fix for
now, and save anything more radical for a future revision.

Has anyone else implemented ReadChannels?

-Paul

Reply via email to