[squeak-dev] Re: Newbie Question (about OOPs, maybe) (sorry)
Alejandro F. Reimondo
aleReimondo at smalltalking.net
Sat Aug 22 14:28:27 UTC 2009
Hi,
IMO, an object is something that preserves identity under the pov
of an objerver (the self that reflectOn/know/named "the object");
for me, an object can be open in state and behavior (change in
an unpredictable way) and still be "that object".
Returning to your question about identity, imho it is "something" in the
observer, that reflect on a context through time (here the
virtue of the object-subject relation). The object
preserve the identity in the context known to that
observer (under a pov)
The observer name the object (acording to convenience/role in
the "understanding"/control of the context).
Using a number for the name is primitive but can be understood
as a valid name.
In short, the ID is a name that is defined by the observer when
it is detected a presistence in time of something taking a
role (a model of the observer is the place to implement it).
No need to have an unique ID for each object, because the
universal pov it asumes is a gravitator(innocent) and hide
diversity of observers, the same way as an object realty
is hidden if one assumes a system is defined by one source code.
cheers,
Ale.
----- Original Message -----
From: Trygve Reenskaug
To: The general-purpose Squeak developers list
Sent: Saturday, August 22, 2009 7:39 AM
Subject: Re: [squeak-dev] Re: Newbie Question (about OOPs, maybe) (sorry)
Hi All,
IMO, every object has three essential properties: Identity, State, and Behavior. In Smalltalk, State and Behavior are defined by the object's flattened class hierarchy. The Object ID is not explicitly available. I have am using 'asOop', hoping I get a unique value. But I realize that I am skating on thin ice because its comment confuses me with implementation details. It doesn't say what it means by 'pointer', so there is still hope:
Object>>asOop
"Primitive. Answer a SmallInteger whose value is half of the receiver's
object pointer (interpreting object pointers as 16-bit signed quantities)..."
ProtoObject>>identityHash
"Answer a SmallInteger whose value is related to the receiver's identity..."
This is pretty vague, but the term 'Hash' indicates that many objects can share the same value. So it is clearly cannot be used as the objectID.
The Morph>>printOn: implementation is less than ideal because it should apply to all objects, not only Morphs. Also, it should use 'asOop' rather than 'identityHash' to let us hope for uniqueness.
In short:
a.. Smalltalk claims to be object oriented and I regard it as a serious flaw that the object ID is not explicitly visible.
b.. We probably need a 64-bit VM to represent it properly, e.g., using the standardized definition of OID, but a value that is guaranteed to be unique within the current set of objects would be acceptable..
c.. I regard it as a bug that Object>>printOn: does not present some kind of object ID.
Cheers
--Trygve
On 2009.08.20 06:37, K. K. Subramaniam wrote:
On Wednesday 19 Aug 2009 11:07:29 am Ronald Spengler wrote:
Ah, so the GC in the VM swizzles the pointers out from under you.
http://lists.squeakfoundation.org/pipermail/squeak-dev/1999-June/006170.htm
l
This is the classic dilemma between name as an identifier and name as a
locator. The word "pointer" connotes the latter but gets used widely in the
former sense in Smalltalk code. Object Identifier (oid) is unambiguous but
doesn't sound half as cool as oop ;-).
Subbu
--
Trygve Reenskaug mailto: trygver at ifi.uio.no
Morgedalsvn. 5A http://heim.ifi.uio.no/~trygver
N-0378 Oslo Tel: (+47) 22 49 57 27
Norway
------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20090822/c525010c/attachment.htm
More information about the Squeak-dev
mailing list
|