[Glass] 0.01 copy == 0.01

Mariano Martinez Peck marianopeck at gmail.com
Thu Feb 27 04:58:13 PST 2014


Hi guys,

I was checking some differences from sixx exported files from Pharo and
GemStone and I noticed in GemStone equal floats (but "different" instances)
were serialized like if they were the same instance. Then I did some
experiments:

| anObject |
anObject := OrderedCollection new.
anObject add: 0.01.
anObject add: (Float readFrom: '0.01').
anObject first == anObject second
-> true

or

0.01 copy == 0.01
-> true

So...is this a compiler optimization? Is it something related to the fact
that SmallDouble are immediate objects?

Thanks,

-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20140227/eff94be1/attachment.html>


More information about the Glass mailing list