BUG with OrderedCollection new writeStream ?

Paolo Bonzini bonzini at gnu.org
Fri Sep 21 06:53:05 UTC 2007


>> I've wondered though if it's necessary.  The adapter solution is 
>> better in my humble opinion, because it is stupid that the stream 
>> imposes a growing policy to a growing collection, and because an 
>> "adding stream" would not need a final copy when calling #contents.
> 
> True, however, the adapter solution makes it very difficult to create 
> streams that work on both sequenceable and arrayed collection. For 
> example, is GZipWriteStream a subclass of WriteStream or 
> AddingWriteStream?

Neither, it's a decorator :-)

> Do we need two classes, one for sequenceable and one for arrayed collections?

Yes, but a single constructor method #writeStream that picks the right 
one.  So, you trade...

> a single polymorphic way that streams can use to 
> access both arrayed and sequenceable collections vastly preferable.


... with a single polymorphic way to create the stream.

Paolo



More information about the Squeak-dev mailing list