[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: consistency in Self
> Maybe this is an extreme point of view - but don't you think it's inconsistent
> that you can't have a parent slot 'implemented' as a method?
> OK - so it might be a bit slow - you'd have to call the parent slot method(s)
> for an object for every message it received.
Given the obvious implementation difficulties, a pragmatic answer
could be to ask for some examples demonstrating the usefulness of
methods-as-parents. (Implementation is difficult because it's hard to
"constant-fold" a method execution and thus to inline a send whose
lookup goes through a "method parent".)
But besides the implementation difficulties there are some semantic
problems: in what context is the method evaluated (i.e., what is
"self")? And what happens if the method sends a self message? The
resulting (potential) infinite recursion would seem to limit the
usefulness of methods-as-parents (you could only send messages
accessing slots in the object itself or in descendants).
On the other hand, they would be a wonderful tool for an annual
Obfuscated Self Contest. :-)