Saturday, September 18, 2004 at 11:17PM
Properties are functions on objects. For example:
- The fields of records are property functions of those records.
- The fields and attributes of objects are property functions of those objects.
- Associations between objects are property functions of the source objects.
- Procedures and operations on objects can also be seen as property functions on those objects. This is even when they only bring about a change of state in the object, and do not appear to return any value. In these cases it is possible to regard the next state of an object as a property of that object, and to consequently treat it as a property function.
- Time is also is also a property function of objects. This has far-reaching implications for object identity which I shall go into in a later article on Object Identity and Time.
Every object has an infinite number of properties. Two objects are identical if and only if they yield the same value for every one of these properties, even the ones that are unspecified. In effect, this means that variables can only be identical if they refer to the same object (all their properties are the same so they are the same - this is one half of Leibniz's definition of identity: the useful half).
This object identity corresponds to reference semantics in programming languages. It is what we get when we manipulate and copy pointers to objects rather than the objects themselves. The pointers can be thought of as object identifiers.
The apparently more simple value semantics is actually more complicated. This is got by restricting comparisons and copying to a finite subset of properties. For example, to compare two points on the Euclidean plane we use a function that compares only their x and y coordinates and ignores all other properties. This form of comparison is more complicated because you need a separate special-purpose comparison function for each finite subset of properties. For example, if we think of the above two points as being in 3-dimensional Euclidean space the function would compare the x, y and z coordinates and ignore the rest.