BUG with OrderedCollection new writeStream ?

Andreas Raab andreas.raab at gmx.de
Fri Sep 21 07:01:17 UTC 2007


Paolo Bonzini wrote:
>>> 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 :-)

Assuming you represent every new write stream as a decorator (I was only 
giving an example).

>> 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.

Plus having to have all new write streams be decorators. It's doable but 
doesn't strike me as superior to adding a single method in two classes.

Cheers,
   - Andreas



More information about the Squeak-dev mailing list