[squeak-dev] re: Read-only source files

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Wed Jan 21 01:58:29 UTC 2015


2015-01-21 2:31 GMT+01:00 Craig Latta <craig at netjam.org>:

>
> > ReadWriteStream really is a complex beast.
>
>      Now *that* is certain. The traditional Stream implementation is
> significantly bogus. I've never had a need for a write-only stream, so
> all streams can be readable by default; any exceptional circumstances
> can use... exceptions. Then ReadStream, WriteStream and ReadWriteStream
> go away, instead there's a WritableStream subclass of
> PositionableStream. Lots of discussion about multiple inheritance and
> traits also goes away, which is pleasant. ;)
>
>
Interesting POV.
Following the Xtreams principles, I went the opposite way, rewriting every
usage of ReadWriteStream into either ReadStream or WriteStream. I did only
published some in trunk, but have more unfinished/untested...
I never had to intermix read and write randomly in a stream, this should be
reserved to very specific things like sharing state as in a database.
Streams make sense for sequential processings, less for random access.
Indeed, most usage of ReadWriteStream in Squeak is just for chaining
several processings (like a unix pipe).
So if I write into a collection thru a WriteStream, then read the contents
with a ReadStream, I'm done.

No complex multi-purpose objects with complex capabilities and exceptions,
just simple objects with simple capabilities, composition and delegation.

Nicolas


     I suspect this is how They would have done it in the first place
> back in the day, if they had had exceptions.
>
>
> -C
>
> --
> Craig Latta
> netjam.org
> +31 6 2757 7177 (SMS ok)
> + 1 415 287 3547 (no SMS)
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20150121/589dd312/attachment.htm


More information about the Squeak-dev mailing list