Very strange bug on Streams and probably compiler

nice ncellier at ifrance.com
Wed Feb 14 21:27:41 UTC 2007


Mathieu Suen a écrit :
> 
> On Feb 14, 2007, at 9:08 PM, Klaus D. Witzel wrote:
> 
>> On Wed, 14 Feb 2007 20:58:21 +0100, Bert Freudenberg wrote:
>>
>>> On Feb 14, 2007, at 20:27 , Roel Wuyts wrote:
>>>
>>>> 'foo' = 'foo'             true        "ok"
>>>> 'foo' == 'foo'             true        "NOT OK"
>>>> [...]
>>>> I can only conclude that this is really not what you want.....
>>>
>>> Why? If you want to test for identity, use a Symbol.
>>>
>>> IMHO this is splitting hairs over a non-issue. The issue is 
>>> mutability of literals.
>>
>> ... which are not constants but objects created from literally 
>> descriptions, therefore their name :)
>>
>> IMHO Lukas had the best suggestion so far, something like a preference 
>> which demands to compile literals as if they where constants.
> 
> Yes but this will be messy since you don't know when you have to turn it 
> on or off. Isn't it?
> 
>     Math
> 

I would hate that same code lead to different results depending on a 
global preference set somewhere in the image...

Unless you use:

a) a compiler directive in a pragma (i know, Lukas don't like this use 
of annotations)

	<thisCompiler literalAreMutable: false>
	WriteStream on: 'test'.

b) a message explicitely stating the literal should be mutable.

	WriteStream on: 'test' beMutable.

Nicolas


>>
>> /Klaus
>>
>>> - Bert -
>>>
>>>
>>>
>>>
>>
>>
>>
> 
> 
> 




More information about the Squeak-dev mailing list