Re: Clean Object Class Design -- Circle/Ellipse

From: Marc Gluch <marc.gluch_at_mindtap.com>
Date: 21 Aug 2001 08:11:44 -0700
Message-ID: <6c9a2e10.0108210711.66f84b1_at_posting.google.com>


"Richard MacDonald" <macdonaldrj_at_att.net> wrote:

> Lousy word on my part. Having the result of an operation be a
> type unrelated to the argument type. The age of a Person
> is an Integer. Person and Integer are not related types.
They don't have to be.
A generic function is "typeless", e.i. of a type: Type -> Type (so to speak). Input and output don't have to be the same type. Such function defines a relationship between the input and output that is independent of the concrete type of input and output. Another, perhaps more accurate way to explain it is to say (per Liskov) that an abstract type is a set of operations (you can't instantiate an abstract type).

> > The way I prefer to put it is to say that
> > one specialization/implementation should not redefine another.
> > They all should be (parallel) implementations of a generic
> > (ala CLOS) function.
> >
> Ok, but this confuses me. You seemed to be trying to
> build up the type theory strictly from axioms ...
Yes

> that were limited to staying "within" a type hierarchy.
The phrase "stay within" in some subtle way rubs me wrong. I feel more comfortable saying that the additional axiom(s) need to be consistent with those of the supertype (parent theory).

>The above statement does not have this limitation.
Perhaps my original explanation was incomplete. Does the current (generic/Liskov) elaboration help?

In my Smalltalk example:
Magnitude introduces the (generic) concept of order: {<}. Number introduces the generic concept of arithmetics: {+,*}. Integer, Fraction and Float are concrete types (i.e realizations) of the abstract supertype. There are plenty of morphisms among them, but that doesn't mean that one type is a subtype of another. Because they are realizations (implementations), you can always find a property that makes them inconsistent. That property is ... representation.
The supertype must mitigate such inconsistencies
by defining the axioms of conversion (casting).

Marc Gluch
Mindtap Inc. Received on Tue Aug 21 2001 - 17:11:44 CEST

Original text of this message