Re: domains aren't subtypes, right?

From: Bob Badour <bbadour_at_golden.net>
Date: Fri, 23 May 2003 12:10:21 -0400
Message-ID: <mrsza.221$mc1.67692577_at_mantis.golden.net>


"Alfredo Novoa" <alfredo_at_ncs.es> wrote in message news:e4330f45.0305230343.b8ca8bd_at_posting.google.com...
> "Marshall Spight" <mspight_at_dnai.com> wrote in message
news:<DGhza.951082$F1.115813_at_sccrnsc04>...
>
> > Then you could decide what operators/functions
> > this new type would "get" (inherit?) from its originating type. For
example,
> > you might want to compare city values for equality, or for lexical
order,
> > but you wouldn't meaningfully want to concatenate city values, even
> > though city comes from string and string has a concat operator.
>
> Agreed.
>
> > Sometimes I hear this called a "domain" but that word seems heavily
> > overloaded.
>
> Type and domain are used as synonyms.
>
> > So what is the relationship of the city type to the string type? It's
> > not a subtype.
>
> It is. I don't see any problem. We simply must decide which operators
> we want to inherit.

Alfredo, I have to disagree with your above statement. If it is a subtype, it inherits all value operations. If it does not inherit all value operations, it is not a subtype. A subtype has a subset of the values and a superset of the operations of all of its supertypes.

In the specific example given, "string" is merely a possible representation of the city type. City might be a subtype of location or of geographic area, for instance, but it is not a subtype of string.

> For instance we probably don't want to have a focus_distance operator
> in a circle type.

Why not? Received on Fri May 23 2003 - 18:10:21 CEST

Original text of this message