On Jan 17, 2010, at 6:30 PM, laurent laffont wrote:

> Hi,
> 
> Something strange to me: 
> 
> '2' = '2'. -> true  (OK)
> (2 asString) = (2 asString). -> true  (OK)
> 
> (2 asString) == (2 asString). -> false  (OK)
> '2' == '2'. -> true  ?????
> 

Yes, the same string in the same method points to the same entry in the 
literalframe.

Which explains why this method works:

strange
        'hello world' isString ifTrue: ['hello world' become: {0}].
        'hello world' at: 1 put: ('hello world' at:1) + 1 .
        ^'hello world'  at: 1.

Put this method in Object, than print multiple times:

        Object new strange

:-)

--
Marcus Denker  -- http://www.marcusdenker.de
INRIA Lille -- Nord Europe. Team RMoD.


_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to