[Prev][Next][Index][Thread]
Re: [Q] Dylan to Java/JVM compiler?
On Sat, May 5, 2001, Lieven Marchand <mal@wyrd.be> wrote:
>I don't know enough about Smalltalk to be sure about this, but is it
>really supported to derive from the built in integers and redefine
>addition? In general, a lot of languages I would consider OO from the
>ground up like Eiffel have restrictions on some of the basic
>classes. It's the only way to be able to compile some basic stuff
>efficiently into machine primitives.
It's not the only way. The other way is to provide the semantics of
objects throughout, but optimize most cases to efficient machine primitives.
>I see in the drm at gwydiondylan.org that <integer> is a sealed class,
>so Dylan is as OO as CLOS in this respect.
Yes, but <integer> inherits from <rational> inherits from <real> inherits
from <complex-number> inherits from <number>, which is *open*. So all the
"specific" classes are sealed for efficient compilation, but the root of
that numeric hierarchy is open, allowing for subclassing of <number>. Now
if you truly need to subclass <integer>, this is not exactly what you
want. But if you want to add a new numeric type and add methods that
specialize on it, you can do so.
This seems to be a common idea in Dylan: seal many classes for
efficiency, but leave something up the hierarchy open for unanticipated
needs for expansion.
Scott Ribe
scott_ribe@killerbytes.com
http://www.killerbytes.com/
(303) 665-7007 voice
References: