Re: identity...... Was: The wisdom of the object mentors




sorry about the delay, got caught up doing other stuff.

Dmitry A. Kazakov wrote:
On 5 Jun 2006 02:20:35 -0700, Mark Nicholls wrote:

I'm not really interested in RM vs OO...to me they are to special
cases...but you have intrigued me with some stuff on identity....which
is something I've only recently managed to mildly formalise in my head.

I've dropped the database cross post, in order not to become involved
in the rather harsh attacks on Mr Martin.

Dmitry A. Kazakov wrote:
On 1 Jun 2006 02:58:43 -0700, Erwin wrote:

Note further that the OO crowd always uses the term with respect to one
single thing ("the identity of an object").

This is not true. As for identity of objects there are many of. For
example, polymorphic objects have the identity of its specific type.

not with this....for me an object has 1 identity.
Can you give me an example.

You are asking difficult questions, Mark!

I would think of identity as a function that returns values from some set,
on which equality "=" is defined:

id : Object -> Identity

This allows you to invent an "equality" on values of Object as

"=" : Object x Object -> Boolean

function "=" (X, Y : Object) return Boolean is
begin
return id (X) = id (Y);
end "=";


how is '=' defined in the space of identities?

OK....so (to you) an identity is an equivance class on a relation '='?

If you have many such functions, then the object can have many identities.

yes

Examples:

1. Self-identify. Let values of Object have "=" defined. Then self-identity
is a function that returns the object value.


doesn't this exampe make your definition of '=' self referential?

or have I missed the point.

1.a-1.z. You can have as many different "=" as you wish.

I see this in principle (though my own feeling on identity is
different).


2. Referential identity. Let there be a pointer type defined for Object and
the pointers are comparable (and you know some other things about the
language, which are irrelevant here). Then (in C++ notation) "&" that
yields Object pointer is identity.

3. Type identity. typeof (Object) is identity. Note that it is not required
that "different" objects had different identity. For typeof all objects
will have the same. You will not be able to identify them. So typeof is
interesting for polymorphic objects only.

4. Timestamp.

5. Association / Member of. Consider container iterator. I'd say that the
iterator, index, key, etc + the container is an identity of an element in
the container. 2 is a case of 5.

6. Name identity. The language defines some naming for objects and names
are comparable.

Important is that the words "different"/"same" are illegal words. You can
ask if "=" would return true. But that would imply nothing in the language.
It is OOA/D issue to give "=" any meaning. This meaning is beyond the
language in the domain space.

basically to you an objects identity is some mechanism in order to
identify it....externally....i.e. bound up with '=='....

to me identity is some internal mapping from objects to
values.....values being immutable (i.e. of constant
behaviour)....objects not so....i.e. it is part of an encapsulated
construction that implements the specified behaviour.


The
identity of objects in its usual sense is not required in OO. It is quite
possible to have unidentifiable objects.

OK, I actually agree with this in a way.....but probably not in the
same way as you.

Can you give me an example though.

An object for which neither of above is true: "=" is not defined. Pointer
cannot be taken, etc. It can be conditional. For example, we could talk
about objects of unidentifiable types, or about the aliasing problem etc.


OK.

The OO crowd thus never uses that term in the "relational" sense of the
word.

I don't see much difference in respect of identity. The standpoint is that
there is no data, only behavior. Data is expressed in observed behavior. So
there is no immanent identity of values. There is only "=" relation defined
on them (if any). The object is same as long as it exposes same behavior.
Any question about what is inside is illegal.

not sure about this......I think it depends on context....but can't
really properly comment unless I understand the above.

This only means that if you have two names X and Y denoting some objects,
there is no unified / guarantied way to tell if they are same.

you claim this, and then give a very good potential "unified /
guarantied way" of doing so.....

Same = "any
possible program in which X is swapped with Y cannot detect any
difference." If you *know* that they are same (God spoke to you (:-)), then
just tell others, i.e. define "=", use same names etc.


.



Relevant Pages