On Sun, 17 Jan 2010, Nicolas Cellier wrote:
One of my first bug in st80 was
strange
^('foo' writeStream) nextPutAll: '-bar'; contents.
At that time, writing pastEnd did use become:
But if you really have time to pick an immutability bit in Newspeak,
we don't have to care anymore.
If I had a free bit in the object header, I'd use it for extending the
identity hash instead of useless things like immutability. IMO it was a
mistake to add immutability for literals in other smalltalks only to avoid
possible errors generated by the broken stream/collection semantics.
Levente
Nicolas
2010/1/17 Marcus Denker <[email protected]>:
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
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project