On 07/02/2012 06:02 AM, Marc Feeley wrote:
> I also expect a bidirectional port when doing
>
>     (open-file "/dev/tty")
>
> and
>
>    (open-tcp-client "google.com:80")

open-file doesn't exist and is meaningless.  Open for reading?
Open for writing?  Open for whatever I have permissions for
(which we know leads to security and other problems)?

> It is conceivable, but non-trivial, to arrange for these procedures to return 
> 2 values: an input port and an output port (some Scheme systems do this), but 
> then it becomes bothersome to pass these two values around consistenty 
> (unless of course you cons them together, in which case you basically have an 
> ad-hoc bidirectional port!).

No.  The Right Solution IMNSHO is that (say) open-tcp-client
returns a "connection" or a "socket" object.  It's a historical
accident (i.e. a design mistake) for Unix to conflate the types
of file/port and connection, since a connection has two files
*plus* other state.

I.e. a connection is fundamentally a different kind of object than
a port.  Trying to conflate them is a design bug.

(Some environments (including Java) don't support bi-directional ports
(except in Java's case RandomAccessFile).  This means that mapping Scheme
ports to implementation ports becomes ugly.)
-- 
        --Per Bothner
[email protected]   http://per.bothner.com/



_______________________________________________
Scheme-reports mailing list
[email protected]
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports

Reply via email to