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

Re: Last call

This page is part of the web mail archives of SRFI 106 from before July 7th, 2015. The new archives for SRFI 106 contain all messages, not just those from before July 7th, 2015.

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: ktakashi@xxxxxxxxx