The definitions of basic methods are part of the definition of a type.
The results of some methods can depend on context. For example, the result of an "age" method may vary depending on the time when the method is invoked.
The definitions of basic methods are part of the definition of a type.
A type does not have to redefine the method names that are defined in its supertypes. It may do so, however, if it wishes to define the method in a more constrained way, or describe the derivation differently. Constraints imposed by the supertype's definition must still be honored in the subtype's definition, if the method name is reused. In particular, this means that the return type may contravary, but the arguments must covary.
It is all right to have two supertypes that define two different methods under the same name. But any invocation of the method must specify not only the proper name, but the name of the type in which the desired method is defined. (The name of the type can be omitted if the method name alone is unambiguous.) The method name can also be unambiguously redefined in the subtype if the subtype's definition can conform to both supertype definitions. If no such definifion is possible, the method name may not be redefined.
In some cases, certain methods may be labeled as "derived". These are also called on a particular object, but the results of these methods are completely dependent on the basic attributes and methods. For instance, from the basic integer method "successor", "predecessor", and "is_zero", one can define derived methods for addition and subtraction. The semantics for derived methods should explain how to obtain the derived method from the basic methods. (Agents are free to implement the methods more efficiently if they wish, though. It would be extremely slow to implement addition by repeated succession, though it is possible to do so if required.)
Derived methods can be very useful, since many objects have simple definitions, but many commonly invoked operations that are based on the basic operations. Also, derived methods can be added to a type description without changing its basic definition.
(We don't handle class-based methods yet.)
spok@cs.cmu.edu (Last updated 29-Dec-94)