Sep 27 meeting notes

Oliver Hunt oliver at apple.com
Fri Sep 30 21:01:01 PDT 2011


Imagine

class Foo {
   function name() {
         return "foo"
   }
}

class Bar : Foo { // s/:/extends or whatever
   function name() {
         super.name();
   }
}

class Wibble : Bar {
   function name() {
         super.name();
   }
}

the call to super.name() essentially desugars to:

this.__proto__.name.call(this, ...)

But this.__proto__ will be the same everywhere, so someWibble.name() will infinitely recurse when it reaches Bar::name

Hope this helps.

--Oliver

On Sep 30, 2011, at 7:38 PM, John J Barton wrote:

> On Fri, Sep 30, 2011 at 5:47 PM, Axel Rauschmayer <axel at rauschma.de> wrote:
>> 
>> Isn't it just a matter of referring to the property with "super"?
>> class Pirate {
>>   get name() {
>>     return "Captn' " + super.name;
>>   }
>> }
> 
> just trying to understand: how is super different from __proto__?
> jjb
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list