A birds Eye View of Objects
Terms must often be defined in groups, as in mutual recursion.
Here we introduce our perspective on objects while being compatible with the literature where it does not do violence with our ideas.
In this view of objects we can see inside objects even though the purpose of object technology is to provide views where some objects are opaque.
With these terms we can understand how such opacity is achieved.
There are in the world objects, references and programs.
Our references here are often called ‘capabilities’ or ‘keys’.
‘reference’ is borrowed from programming language theory which provides a close analog to out notions.
As we say that there is one floating point number that denotes 3, we say that there is one reference that denotes some particular object.
There is a floating point number for 3 even when there are no places in the computer that hold that number just now.
Such talk allows us to say that for any particular object there is one reference to that object, even though no such reference may be stored in the machine just now.
Speaking this was we say that there is a one-to-one correspondence between objects and references.
Inside an Object
Objects have a mutable state, an immutable behavior and namable mutable slots.
A slot always holds a reference (to an object).
An object’s state is just some collection of data in the ordinary computer science sense of the word and we will not be much concerned here about its nature.
An object’s behavior is for our purposes a program in some fairly ordinary computer science sense.
- Our programs emphatically lack what Algol 60 called ‘own variables’ which endowed the program with memory.
- Just as programs can conventionally refer to their data with pointers (data addresses) which can themselves be found in the data, our programs can also have slot addresses which serve to name the slots of an object that obeys the program.
- Just as a program can direct the modification of the state of an object that obeys the program, so can the program direct the modification of a slot of that object.
We could do largely without the word for we say that when I send a reference (to some object) to you, then you and I have the same reference.