why we should get rid of asOop :) http://code.google.com/p/pharo/issues/detail?id=1074
Begin forwarded message: > From: "David T. Lewis" <[email protected]> > Date: August 23, 2009 5:52:25 PM CEDT > To: The general-purpose Squeak developers list > <[email protected] > > > Subject: Re: [squeak-dev] Re: Newbie Question (about OOPs, maybe) > (sorry) > Reply-To: The general-purpose Squeak developers list > <[email protected] > > > > On Sun, Aug 23, 2009 at 04:36:24PM +0200, Bert Freudenberg wrote: >> On 23.08.2009, at 11:42, Trygve Reenskaug wrote: >>> On 2009.08.22 17:26, Bert Freudenberg wrote: >>>> On 22.08.2009, at 12:39, Trygve Reenskaug wrote: >>>>> In short: >>>>> ? Smalltalk claims to be object oriented and I regard it as a >>>>> serious flaw that the object ID is not explicitly visible. >>>> >>>> What if there simply *is* no object ID? >>> In Smalltalk, a value is a pointer to an object. Bluebook p. 564: >>> "Each object is associated with a unique identifier called its >>> object pointer. ..." >> >> ... digs out Blue Book ... >> >> Yes. This is the VM implementation chapter. IMHO it does not mean an >> OOP has to be accessible from the image as an integer. >> >>> Smalltalk MUST have such unique identifiers to work. I see this >>> pointer as the object's ID. I have seen from the discussion in this >>> track that the VM can actually change this "unique" pointer. >> >> The VM can do anything as long as you can't tell from the image. And >> you can't. OOPs cannot be accessed directly. > > To illustrate the current behavior in Squeak, I used a plugin that > displays OOP values, addresses, etc. Thus: > > (1 to: 100) do: [:e | Array with: e]. "make some garbage" > aString := 'Hello there'. "allocate an object" > aString asOop. => 1422 "identity hash for the object" > OopPlugin oopPrintStringHex: aString. '16r0FF3BE64' "current OOP > value" > OopPlugin machineAddressPrintStringHex: aString. > '16r00002B66BBE8AE54' "C pointer to object header" > Smalltalk garbageCollect. "cause objects to move around in the > object memory" > aString asOop. => 1422 "identity hash remains the same" > OopPlugin oopPrintStringHex: aString. => '16r0FF36954' "OOP value > has changed" > OopPlugin machineAddressPrintStringHex: aString. => > '16r00002B66BBE85944' "object has moved" > > The OOP is a unique identifier for the object at a particular > instant in > time, but the VM is free to change it at any time without telling you. > > Dave > > _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
