On Tue, Nov 1, 2011 at 3:21 PM, Axel Rauschmayer <a...@rauschma.de> wrote:

>
> Another problem: What if an instance method makes a super-call?
>
> A slightly less elegant (and performant) variant of your solution that
> works in both of the above cases is:
>
> - Keep track (per object and method) of the object where the previous
> super-call (e.g. super.foo()) ended up.
>
> - Start your search either there or at |this|: look for the *second*
> occurrence of property "foo". [optional: optimize non-|this| case]
>

Nope -- I think that design isn't the correct semantics. super() exists to
delegate back to parent implementations of *the current method*. When
calling a different instance method the calls should always start back out
at the bottom of the inheritance hierarchy -- not at whatever level you
happened to be on at the time.

If you haven't overridden the other instance method, then everything will
work as expected ... and if you *have* overridden it, you need that
overridden implementation to be called, otherwise you're breaking all kinds
of expectations about the behavior of your code.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to