Very strange bug on Streams and probably compiler

Klaus D. Witzel klaus.witzel at cobss.com
Wed Feb 14 17:49:08 UTC 2007


Hi Stef,

on Wed, 14 Feb 2007 18:40:31 +0100, you wrote:
>> Stef,
>>
>> why should strings be immutable, and why blame the compiler.
>
> I'm not saying that. I'm saying that since strings are not immutable  
> then the compiler should not optimize the strings in a compiled method.
>
>> The same situation is, for example, with Associations. In order to  
>> prevent mutation, someone invented ReadOnlyVariableBinding.
>>
>> Literals have nothing much to do with compiler optimization, see  
>> senders of #encodeLiteral:, just with determining the correct bytecode  
>> for pushing them onto the stack.
>>
>> But of course the compiler could emit code for always copying string  
>> literals, if you can afford the performance penalty.
>>
>> As Bert wrote: it's normal :)
>>
>> [Okay okay other languages have immutable string, but this is  
>> Smalltalk.]
>
> This is not my point.
>
> do you think that from a language point of view this is good to say
>
> ok two strings are not identical if they are typed in different methods  
> but if there are typed in the same methods
> they are identical?

Ah :) Now you know why I asked :)

[BTW: if you are able to compare string from different methods, why should  
anybody suddenly lack this capability when it comes to strings in the same  
method? The more general (comparision method) subsumes the more specific  
(comparision method). What else would someone need?]

Any other examples besides strings?

/Klaus

> This is why I got some of my slides not working when I switch from  
> Visualworks to Squeak I do not have an old version of visualworks
> but it seems that they were consistent with the view they offered to  
> strings to programmers.
> and consistent is important.
>
> Stef
>
>





More information about the Squeak-dev mailing list