[Pharo-project] String and Symbol comparison
Lukas Renggli
renggli at gmail.com
Fri Nov 14 09:05:11 CET 2008
On Fri, Nov 14, 2008 at 8:57 AM, Stéphane Ducasse
<stephane.ducasse at inria.fr> wrote:
> I should say that I always like the fact that
>>
>> 'abc' = #abc --> false
>> #abc = 'abc' --> false
>
> Because a symbol and a string are different to my eyes.
> But when there was the discussion a while back
> I understood that a symbol is a kind of string.
>
> Now how can we make progress on that point
> - evaluate the risks
> - write some tests for strings and symbols
> - give a try
> - but do that for pharo 1.1 :)
Ok, I will file an issue so that we don't forget.
Along the same lines is that strings implement the complete arithmetic
protocol. In my opinion that should go away as well: it is a source of
errors and portability issues. Furthermore it looks really
unprofessional:
'1' + '2' --> '3' (in Pharo/Squeak)
I guess this is some eToy remnant.
Lukas
> stef
>
> On Nov 14, 2008, at 7:46 AM, Lukas Renggli wrote:
>
>> I want to open this for discussion:
>>
>> In all Smalltalk dialects the following expressions evaluate to false:
>>
>> 'abc' = #abc --> false
>> #abc = 'abc' --> false
>>
>> This means a String and a Symbol is never the same thing, even if they
>> contain the same characters. In Squeak/Pharo this is different though
>> (at least this is symmetrical, pre 3.9 this wasn't even symmetrical):
>>
>> 'abc' = #abc --> true
>> #abc = 'abc' --> true
>>
>> Unfortunately this difference makes writing portable code that deals
>> with symbols and strings a huge pain. And it is hard to test, debug
>> and find those kind of problems.
>>
>> I wonder if it would be possible to change that behavior in Squeak to
>> match the other Smalltalk implementations? I guess this would break
>> some code, but at least this problem would then be gone forever.
>>
>> Lukas
>>
>> --
>> Lukas Renggli
>> http://www.lukas-renggli.ch
>>
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project at lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
--
Lukas Renggli
http://www.lukas-renggli.ch
More information about the Pharo-project
mailing list