On 30/06/2013 09:45, Per Bothner wrote:
> What is a binary input/output port? There is no such thing in R7RS.
The latest standard of Scheme (R6RS) defines what input/output port. (So
far R7RS is yet draft state, I know it will be the latest standard
sooner or later, but as long as standard defines it there is such thing
in Scheme world.)
> I'm not talking ideal/clean design here. The Java Socket class has
> two separate methods: getInputStream and getOutputStream.
I'm not sure how Kawa implements ports but if you have Scheme ports
class/interface then can't it be like this?
// InputOutputPort interface
package org.scheme;
// InputPort and OutputPort define read and write methods
public interface InputOutputPort extends InputPort, OutputPort {
}
// SocketInputOutputPort
package org.scheme;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
public class SocketInputOutputPort implements InputOutputPort {
private InputStream is;
private OutputStream os;
private boolean close = false;
public SocketInputOutputPort(Socket socket, boolean close) {
is = socket.getInputStream();
os = socket.getOutputStream();
this.close = close;
}
// implements read and write
}
_/_/
Takashi Kato
E-mail: xxxxxx@ymail.com