[squeak-dev] Why ReadWriteStream>>#contents?

Chris Muller asqueaker at gmail.com
Tue May 1 22:16:17 UTC 2018


C'mon, it has 9 tiny, concise methods, (15 including extensions from
EToys and Compression) and so only Tim is allowed to characterize that
as an "awful mess".  :)   No seriously, being the superclass for
FileStream, it handles all of Squeak's file contents processing and works well.

I guess Chris' explanation is a reasonable explanation for such glaring
inconsistencies in behavior between superclass and subclass, so I
ended up adding my own #content method which does what I want...



On Tue, May 1, 2018 at 3:21 PM, Nicolas Cellier
<nicolas.cellier.aka.nice at gmail.com> wrote:
> IMO ReadWriteStream is an awfull mess and should better not be used at all.
>
> 2018-05-01 22:00 GMT+02:00 Chris Muller <ma.chris.m at gmail.com>:
>>
>> Does anyone know why ReadWriteStream overrides #contents from WriteStream?
>>
>> WriteStream behaves as I would expect
>>
>>    |stream| stream := WriteStream on: String new.
>>    stream nextPutAll: 'chris'; reset; nextPutAll: 'C'; contents     "--->
>> 'C'   as expected"
>>
>> but ReadWriteStream doesn't...
>>
>>    |stream| stream := ReadWriteStream on: String new.
>>    stream nextPutAll: 'chris'; reset; nextPutAll: 'C'; contents     "--->
>> 'Chris'   unexpected!"
>>
>> I want to reuse a ReadWriteStream, so I want #contents to honor the end
>> position.  What's going on here?
>>
>>
>>
>
>
>
>


More information about the Squeak-dev mailing list