Minimalist Classes

Axel Rauschmayer axel at rauschma.de
Tue Nov 1 12:06:05 PDT 2011


My bad. I thought obj.foo() and this.foo() were different cases, but they obviously aren’t.

On Nov 1, 2011, at 20:03 , Jeremy Ashkenas wrote:

> 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.

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111101/7e3f6bb3/attachment.html>


More information about the es-discuss mailing list