[Newbies] Testing = and == in workspace

Levente Uzonyi leves at elte.hu
Sat Jan 7 18:03:51 UTC 2012


On Sat, 7 Jan 2012, Ben Coman wrote:

> Bert Freudenberg wrote:
>
>  Am 07.01.2012 um 07:04 schrieb Ben Coman <btc at openInWorld.com>:
> 
>
>  I had thought that the two assignments of 'xxx' to (x) and (y) would result in different objects, but they turn out to be identical.  It is like the compiler has noticed that they are equal and chosen to make them identical.
> 
>
>  That is indeed what's happening. 
> 
> You can verify this by executing each line separately.
> 
> 
> Thanks Bert. Doing that is insightful.  Interestingly the result is different with numbers.  Where strings assigned in separate executions are not
> identical, numbers assigned in separate executions are identical - at lower values.  For example, number 12345678 has (x) and (y) identical but with
> 123456789 they are not.  I then expected those number literals to be a different class, but both numbers inspect as SmallIntegers.  btw this is with

That's impossible, SmallIntegers with the same value are identical.


Levente

> Pharo-1.3-13315-cog2522. 
> 
> Anyway, my curiosity is satisfied for now.
> cheers, Ben
> 
>


More information about the Beginners mailing list