Re: Clean Object Class Design -- Circle/Ellipse

From: Jan Hidders <hidders_at_REMOVE.THIS.win.tue.nl>
Date: 7 Aug 2001 09:11:45 GMT
Message-ID: <9kobch$6q$2_at_news.tue.nl>


Some errata:

Jan Hidders wrote:
> Martijn Meijering wrote:
> >
> > I'd like to get away from discussing Date's understanding or lack of it.
> > Can't we just talk about whether we think a decent OO type system should
> > allow (not force) the integers to be a subtype of the reals and why that
> > would be useful?
>
> If you take Date's vision on OO and use a simply type system (no
> parameterized types or types with quantifiers of types, et cetera) then
> this is a well-understood problem. You can find the relevant literature
> under 'multimethods' and 'subtyping' with Google.
>
> To summarize:
>
> Assume you have a finite set of domains Dom = { D_1, .., D_n } and a
> } finite set of function Fun = { f_1,..., f_n } over these

That should be "Fun = { f_1, ..., f_m }". The number of functions is obviously not neccesarily the same as the number of domains.

> domains (with some of them the same name but over different domains).
> If you assume a subtype ordering, here called <=, over the domains
> then there are two things that should hold.
>
> 1. The first is that if D_i <= D_j then there is a function I[D_i,D_j]
> : D_i -> D_j that "interprets" elements of D_i as elements of D_j.
>
> 2. The second is that the semantics of the functions should respect the
> subtype ordering and this interpretation function. This means that
> if you have two function f_i : D_i -> C_i and f_j : D_j -> C_j with
> the same name and a greatest common subtype D' exists of D_i and D_j

Should be:

     the same name and for all common subtyps of C' of D_i and D_j

> and a greatest common supertype C' of C_i and C_j exists, then if we

Should be:

     and all common supertypes C' of C_i and C_j it holds that if we

> interpret f_i and f_j as functions from D' to C' then they must be
> the same, i.e., for all x in D' it holds that
>
> I[C_i,C']( f_i( I[D',D_i](x) ) ) = I[C_j,C']( f_j( I[D',D_j](x) ) )
>
> So if you tell me what operations you have over the integers and the
> reals, and what your subtype interpreations is, then I can tell you if
> a subtyping relation between them is valid.
 

-- 
  Jan Hidders
Received on Tue Aug 07 2001 - 11:11:45 CEST

Original text of this message