SmallInteger "instances" are so-called immediate objects, i.e. the bytes
are the object. As Steven said, some reserved bits tell whether a 4-byte
word is an immediate (and what kind of). These reserved bits make the
value range for SmallInteger smaller than 4 bytes allow. This is the
reason why 16r20746D66 is represented by a LargePositiveInteger which is
a "real" object, an instance with its own identity.
Comparing LargePositiveInteger instances with #== will most likely
return false - unless you really compare a LargePositiveInteger with
itself. The same consideration is true for "1.0 == 1.0" which is always
false. For each "1.0" in this tiny piece of code, the compiler creates a
new Float instance. They are equal but not identical. Comparing with #=
returns true, comparing with #== returns false.
For comparing number values you better use #=. There is no reason to
optimize on your coding level since the VM and its primitives do the
optimized computation.
- Holger
Vincent Lesbros schrieb:
> May I ask a question ?
>
> 16r20746D66 = 16r20746D66 true
> 16r20746D66 == 16r20746D66 false
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc