Minimalist Classes

Jeremy Ashkenas jashkenas at gmail.com
Tue Nov 1 12:03:01 PDT 2011


On Tue, Nov 1, 2011 at 2:58 PM, Axel Rauschmayer <axel at rauschma.de> wrote:

>
> Another point to consider: What happens if there are several calls
> super.foo() and the last one makes a call this.foo() (infinite recursion
> can be prevented via a parameter)
>

We're getting mixed up in time, as I just answered that in the previous
message. To quote myself:

> ... and even for fancier cases where you restart the same super() chain
recursively
> from the outside. Imagine if one of the deeper super.one()'s itself calls
obj.one(),
> with a direct reference to the instance (and a different parameter, to
avoid infinite
> recursion). You can imagine super counters as a stack instead of a value,
and
> push a fresh one on, popping it when the new obj.one() call exits.

... a simple stack of records, one for each re-starting of the super()
chain, should do. When calling super() from a function, it's easy for the
runtime to tell if that function was itself invoked via super(), or from
the top level.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111101/5e082544/attachment.html>


More information about the es-discuss mailing list