Chapter 8

Specialization by Constraint etc.

Expression X has value v

And value v has MST

Determined, thanks to S by C

—Anon.:Where Bugs Go

In this chapter I propose to examine an aspect of our inheritance model that we regard as both crucial and fundamental, despite the fact that it (or something very like it) has been the subject of much controversy in the literature: viz., the concept we call specialization by constraint. In terms of our running example, the basic point is this: In our model (and indeed in accordance with mathematical reality), an ellipse is a circle if and only if its semiaxis lengths a and b are equal. In other words, if and only if (a) value e is of type ELLIPSE, but also (b) THE_A(e) is equal to THE_B(e), then (c) e is additionally of type CIRCLE—and the system is aware of this fact. And that, in effect, is exactly what IM Prescription 10 says.

IM PRESCRIPTION 10: SPECIALIZATION BY CONSTRAINT

Let T be a regular type (see IM Prescription 20) and hence, necessarily, a scalar type, and let T′ be a nonempty immediate subtype of T. For each such immediate supertype T of T′, the definition of T′ shall specify a specialization constraint SC, formulated in terms of T, such that a value shall be of type T′ if and only if it satisfies all such constraints SC.

image

I need to get a few preliminary matters out of the way before I can get to the substance of this prescription, ...

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.