Re: object algebra

From: Eric Kaun <ekaun_at_yahoo.com>
Date: Fri, 27 Feb 2004 21:25:21 GMT
Message-ID: <5BO%b.18056$2%4.355_at_newssvr31.news.prodigy.com>


"Neo" <neo55592_at_hotmail.com> wrote in message news:4b45d3ad.0402261256.783f8bd2_at_posting.google.com...
> However, if we allow EYE_COLOR = {Blue, Gaping_Unblinking_Sockets, NA,
> UNK} we can no longer use isa, but instead a weaker relationship such
> as isValueOf.

Why? In Date's Tutorial D, you'd define different selectors. One of the problems (among many) with null is that it's untyped, whereas EYE_COLOR("N/A") and INTELLIGENCE_QUOTIENT("N/A") are of different types.

> Thus Blue isValueOf EYE_COLOR.
> Gaping_Unblinking_Sockets isValueOf EYE_COLOR.
> NotApplicable isValueOf EYE_COLOR.
> Unknown isValueOf EYE_COLOR.
>
> If Unknown can be a value of EYE_COLOR, why can't Rock be a value of
> EYE_COLOR?
Because you haven't defined it as such.

> In the above example, the weaker relationship kills inheritance. You
> could try to patch it with custom code, but it could not anticipate
> the nature of all new values added in the future (ie pink, not_sure,
> etc).

Tutorial D's discussion of inheritance is extensive, and there's no such problem. Subtypes cannot violate their supertypes' invariants, unless I've missed something (note that this is unlike many O-O languages). Specialization by constraint does wonders here.

> So are you in favor of NULLs (or its patches) and the resulting weaker
> realtionships?

The above isn't a "patch for" nulls. What does "weaker relationship" mean, though? I have no idea how to address that one. Received on Fri Feb 27 2004 - 22:25:21 CET

Original text of this message