[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Last call
On 30/06/2013 17:47, Per Bothner wrote:
> For an input/output port there are two positions - because there are
> actually two separate ports.
I disagree with this. It seems the point is mixed up with Java's problem
and how port should be. IMO input/output port doesn't have to (or even
must not) have two positions and it is one port. (At least I implemented
it like this in Sagittarius.)
> One could so that, but that means causes compatibility problems with
> the Java I/O classes. InputStream/OutputStream/Reader/Writer are
> all classes, not interfaces, so you can't multiply inherit them.
IMO this is a big mistake of Java. (well this is not the topic what I
want to discuss but just wanted to say.)
> Obviously it is possible to implement InputOutputPort in Java,
> as you show. (I had to make some contortions to deal with binary
> ports.)However, the concept is inherently bogus, so it would be
> a mistake to do so.
If Java's stream and Scheme's port are the same yes, but if it's
different I don't think so, and I think (at least with this case) it
should be different because of the Java's limitation. And I believe
converting port to stream (or reader/writer) is not so difficult.
> If you want an object that bundles both an input port and an
> output port, then use the socket directly. That is what
> C# does - it doesn't even let you (directly) get the two
> streams, but you call Send/Receive directly on the Socket.
For this, removing 'socket-port' is an option. As long as
implementations support custom port, then converting socket to port is
not so difficult. The purpose of this procedure is actually convenience
and reducing implementation dependent layer.