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

Re: Why are byte ports "ports" as such?

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

On 13-Apr-06, at 1:54 PM, Ben Goetter wrote:

If you separate byte ports from character ports, and separate input ports from output ports (at least at the API level), you get an easily type-checked interface. e.g.

open-input-file string [encoding keywords] -> input-character-port
read-char input-char-port -> character
open-input-file-raw string -> input-byte-port
read-byte input-byte-port -> integer

After rereading this part of your message I think I may have misunderstood you. Do you mean that the procedure's signatures should explicit the type of port to indicate the type constraints? That sounds like a good idea. I was just following the RnRS tradition that uses:

  procedure: (read-char port)
  procedure: (write-char char port)

I.e. it does not distinguish input and output ports in the procedure signatures.