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

Re: Specification vs. Implementation



Per Bothner wirte:
>Input streams might be useful, but I don't understand what
>output streams are for.

Michael Sperber wrote:
> They're there mainly for symmetry, for people who want to live
> exclusively in the streams layer.

I don't see the connection.  Input streams are a purely
functional "lazy list of bytes" abstraction.  Output
streams are just a duplicate set of functions that do
more-or-less the same as ports, as far as I can tell.
Output streams can be "translated" but is there any
reason you can't have a translated output port?

Useless symmetry is still useless, especially if it just
ends up being needless redundancy.

A true output stream api would work on "sequence of bytes" too.
The output operation would be something like this:

(output-byte stream byte)
Does not modify either argument.  Creates a new stream,
which is a copy of the 'stream' followed by the 'byte'.
(Lazy copying can be used in practice.)
--
	--Per Bothner
per@xxxxxxxxxxx   http://per.bothner.com/