Chapter 7

Scalar Variables with Inheritance

That mysterious independent variable

—T. H. Huxley:Universities, Actual and Ideal (1874)

Like the concept of a scalar value (see Chapter 6), the scalar variable concept needs some extension if type inheritance is supported, basically because such variables are permitted to have a value whose most specific type is any nonempty subtype of the declared type of the variable in question. IM Prescription 9 addresses this issue.

Note: Of course, IM Prescription 9, like IM Prescription 8 in Chapter 6, is deliberately worded in such a way as to apply to multiple inheritance as well as single inheritance (though only to scalar types in both cases; tuple and relation types are dealt with separately in IM Prescription 28—see Chapter 20).


Let scalar variable V be of declared type T. Because of value substitutability (see IM Prescription 16), the value v assigned to V at any given time can have any nonempty subtype T′ of type T as its most specific type. We can therefore model V as a named ordered triple of the form <DT,MST,v>, where:

  1. The name of the triple is the name of the variable, V.

  2. DT is the name of the declared type for variable V.

  3. MST is the name of the most specific type—also known as the current most specific type—for, or of, variable V.

  4. v is a value of most specific type MST—the current value for, or of, variable V.

We use the notation DT(V), MST(V), v(V) to refer to the DT, MST, v components, ...

Get Type Inheritance and Relational Theory now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.