More on WriteStream>>on:

Klaus D. Witzel klaus.witzel at cobss.com
Wed Feb 14 22:37:56 UTC 2007


Hi Roel,

on Wed, 14 Feb 2007 23:19:04 +0100, you wrote:
> On 14 Feb 2007, at 14 February/19:14, Klaus D. Witzel wrote:
>
>> Hi Roel,
>>
>> on Wed, 14 Feb 2007 18:47:05 +0100, you wrote:
>>
>>> Could somebody who likes the fact that WriteStream modifies the  
>>> collection passed with #on: give me an actual example where this  
>>> behaviour is actually desirable/useful (I am not talking about  
>>> ReadStream here) ?
>>>
>>>
>>> Otherwise put, why should we not change the implementation of #on: in  
>>> Stream to do:
>>>
>>> on: aCollection
>>
>> I would be strongly against such a copy; also a condition like  
>> (aCollection isString) would be way too much. The literal (which people  
>> seem to believe is a constant, it is *not*, it's a *literal* object)  
>> can only be decided by the *caller* to be constant. Besides of that:  
>> performance ...
>>
>> Isn't #writeStream a very meaningful English wording? "caution, we are  
>> the *writers*, we *write* when you ask for #writeStream".
>
> Exactly. That is why the default behaviour could be to not destroy what  
> I pass to it...

Well, this "destroy" *is* subjective :) OTOH, typical example:

	out := WriteStream
				on: (String new: 1000).

Of the 312 users of WriteStream in the current Squeak-dev .image, do you  
happen to know an example which does *not* pass a freshly  
instantiated+completely unused (alternately: an empty one like '')  
subinstance of ArrayedCollection?

> But I was actually asking for real examples where the fact that the  
> usage of one WriteStream has a side-effect on another WriteStream is  
> useful.

I don't load all the packages and investigate them only to answer what you  
can answer yourself, if that'd be what you mean.

Perhaps other people have some experience?

/Klaus

>>
>> /Klaus
>>
>>> 	.... aCollection copy .....
>>>
>>>
>>> --
>>> Roel
>>>
>>>
>>
>>
>>
>
>
>





More information about the Squeak-dev mailing list