chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH 0/5][5] Generalize port directionality and


From: John Cowan
Subject: Re: [Chicken-hackers] [PATCH 0/5][5] Generalize port directionality and add basic refinement types
Date: Sat, 9 Jul 2016 13:01:40 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

Peter Bex scripsit:

> Regarding our earlier discussion, I think it's a good idea to now
> change all procedures which return both an input and an output port to
> return a bidirectional port instead.  This makes it less of a hassle
> to get these values; you wouldn't need receive, call-with-values or
> let-values anymore.

+1

You should make sure that close-input-port and close-output-port close
only the appropriate side of a bidrectional port, and add R7RS close-port
to cleanly close both sides when they exist.  In addition, it would be
good to provide R7RS input-port-open?  and output-port-open?, which are
explicitly designed to detect the case of a half-open bidirectional port.

> For situations when it's desirable to expose only one end of a
> pair, we could create a procedure like "extract-input-port" and
> "extract-output-port" from a bidirectional port.  I'm not sure what
> good names would be for these.

I'm not sure that these are in the spirit of Scheme's duck typing.
In general we rely on programmer restraint to prevent, e.g., mutation
of lists or strings when the rest of the program doesn't expect it.

-- 
John Cowan          http://www.ccil.org/~cowan        address@hidden
Almost all theorems are true, but almost all proofs have bugs.
        --Paul Pedersen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]