Luke Palmer wrote:
Everything that is a Num is a Complex right?
Not according to Liskov .... But this is one of the standard OO
>>paradoxes, and we're hoping roles are the way out of it.
Well, everything that is a Num is a Complex in a value-typed world,
which Num and Complex are in. I don't like reference types much
(though I do admit they are necessary in a language like Perl), and
I'm not sure how this fits there anymore. Anyway, that's beside the
point, since a supertyping need is still there for referential types.
Doesn't the problem largely go away if we allow Num to be a more general
numeric type, and introduce, say, Real for the more constrained set of
numbers that Num currently represents. Of course, if it were truely the
most general, then it'd permit quaternions, etc., but I think that most
people would be happy for Num to be a simplest possible complete
arithmetic type.