[Prev][Next][Index][Thread]

Re: [Q]Why are all classes rooted by <object>



In article <04lzvud73001-2907010803140001@jump-x2-0132.jumpnet.com>, "Tim
Olson" <04lzvud73001@sneakemail.com> wrote:
> Is there a standard "clean" way of wrapping a Dylan object in a proxy
> object?  In Smalltalk, the standard way is to create a new subclass of
> "nil" (instead of "Object"), which means it inherits no implementation
> whatsoever.  Then a single method "doesNotUnderstand:" is implemented in
> that proxy class, which intercepts all messages sent to the proxy object
> and sends them on to the wrapped object.
> 
> But with Dylan's multi-dispatch and a fixed root class of Object, this
> trick doesn't work.

This works nicely in weakly-typed, message-passing languages. For example,
in SmallTalk, Perl or Python you can treat any object that defines a
particular set of methods as being a member of a "type".

In C++, Java and Dylan, however, the language actually cares about the
class hiearchy when dispatching method calls.  So simple delegation is
broken pretty much from the get-go, long before you get to issues of
single-rootedness or generic functions.

Cheers,
Eric



Follow-Ups: References: