Levente Uzonyi wrote:
On Sat, 7 Jan 2012, Ben Coman wrote:

Bert Freudenberg wrote:

 Am 07.01.2012 um 07:04 schrieb Ben Coman <b...@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

I could have sworn I observed that behaviour last night, with the difference between the 8th and 9th digit, being SmallIntegers in both cases, but this morning I can't replicate it. Now the difference is between the 9th and 10th digits, which makes more sense they become LargePositiveIntegers with the 10th digit. I put it down to fatigue from being up too late. (though I would have sworn...)

As a final thing. For some naive reason I thought that the SmallIntegers would stop at 64k. Is it platform dependent on whether the CPU is 16/32/64 bit ?

_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to