Re: By The Dawn's Normal Light

From: erk <eric.kaun_at_pnc.com>
Date: 27 Oct 2004 10:32:07 -0700
Message-ID: <1098898327.014394.62090_at_z14g2000cwz.googlegroups.com>


> If we think of the type definition including operations and have an
> extensible type system, then perhaps we could start with some generic
> "thing" and call that type Object. Then we could extend that object,
add
> some primitive types such as int, double, char, short, boolean, long,
and
> float and then provide a standard library that users can extend as
needed.
> In fact, I think such systems are already out there. What would we
lose if
> we used Java for defining types?

If I define "Integer x = new Integer(5); Integer y = new Integer(5);", I get some of the weirdness associated with Java's handling of values and variables: x != y, but x.equals(y) is true.

Another is Java's lack of multiple inheritance; if you're talking strictly about interfaces, then you're on more solid ground.

Finally, for such basic types, a constraint-based subtyping language such as Date defines in Intro to DB Systems is stronger. It makes more sense to view PositiveInteger as all Integer values that are > 0, as opposed to trying to implement the same in Java...

I'm not knocking Java, my primary language, but the value/variable/reference confusion in much of O-O, and the attendant problems with "aliasing", are rampant in it. At least in how it's usually done. God bless the immutable classes, but even they have problems.

  • erk
Received on Wed Oct 27 2004 - 19:32:07 CEST

Original text of this message