Alexandre Ferrieux | 23 Sep 22:43

TIP 301 obsolescence (Was: TIPs I'd like to see done)

On Tue, Sep 23, 2008 at 5:35 PM, Donal K. Fellows
<donal.k.fellows@...> wrote:
>
>   #301: Split Bidirectional Channels For Half-Close        (possibly...)
>

This one is almost completely nulled by (accepted) 304 [chan pipe].
Indeed, the initial motivation of the split was typically to close the
write-side of a command pipeline so that the child gets an EOF while
we're still listening to its output. With 304, it is now trivially
done:

      lassign [chan pipe] pr pw
      set ch [open "|cmd <@ $pr" r]
      close $pr
      ...
      close $pw
      set final_word [read $ch]

I said "almost" because there is also the important case of sockets
and the shutdown() syscall, allowing to close independently halves of
its duplex channel.
But invoking the heavy machinery of a channel splitter for this
(instead of adding  a [chan shutdown] to sockets) is an overkill.

Are there other similar cases ? (For example, is it meaningful to do
the same to a serial device ? Can we send an EOF on the write side of
COMx and still read ? Alternatively, can't we _always_ open separately
COMx is read mode and write mode, with two separate channels ?)

(Continue reading)


Gmane