Unique Object ref?

Georg Gollmann georg.gollmann at tuwien.ac.at
Tue Jul 4 08:57:18 UTC 2000


At 4:43 Uhr -0400 04.07.2000, Andrew C. Greenberg wrote:
>At 10:33 AM +0200 7/4/00, Johan Fabry wrote:
>>Hi,
>>
>>I was wondering if there was a way to get an unique identifier to an
>>Object, e.g. as an Integer. There is a method asOop in Object (calling a
>>primitive), with comment "Answer a SmallInteger whose value is half of
>>the reciever's object pointer [...]", but as this is only half the
>>pointer, I am doubtful as to the uniqueness of this oop.
>>
>>So, is there a way to get a guaranteed unique oop?
>>--
>>"You are more than the sum       Johan Fabry - Johan.Fabry at vub.ac.be
>>  of what you consume.            Vrije Universiteit Brussel
>>  Desire is not an occupation."   Programming Technology Lab, Room 10F709
>>   -- KMFDM                       Pleinlaan 2, 1050 Brussels, Belgium
>
>The oop for a non-SmallInteger object will always be unique, but 
>will change everytime the object is moved during garbage collection. 
>All equal SmallIntegers have the same oop.
>

Note that in Squeak "asOop" is a misnomer and actually returns the 
identity hash (which is not unique at all). It should be removed. 
There is currently no method to get at the OOP. For more information 
see the discussion about identity hashes a while back.

Georg
-- 
----
Dipl.Ing. Georg Gollmann                TU-Wien, Zentraler Informatikdienst
                                         Wiedner Hauptstr. 8-10
phon:(+43-1) 58801 - 42022              A-1040 Wien
fax: (+43-1) 58801 - 42099
mail:gollmann at zid.tuwien.ac.at
http://macos.tuwien.ac.at/Gollmann.html





More information about the Squeak-dev mailing list