Making "super" work outside a literal?

Axel Rauschmayer axel at rauschma.de
Wed Jun 22 16:02:48 PDT 2011


> From: Brendan Eich <brendan at mozilla.com>
> Date: June 23, 2011 0:21:17 GMT+02:00
> 
>> Is there no per-call cost whatsoever to adding static super?
> 
> No, it's static -- an internal property of the function object set once on creation and (in my view) never changed thereafter unless unobservably (Allen's point about optimizing Object.defineMethod when "handing off" an otherwise-useless function expression).


How does a function get access to its properties? Doesn’t the ability to access "thisFunction" incur any costs? I would expect static super to work as follows:

var Sub = Super <| {
    foo: function me(x) {
        me.super.foo.call(this, x);
    }
}

Does the named function expression cost nothing here?

-- 
Dr. Axel Rauschmayer

axel at rauschma.de
twitter.com/rauschma

home: rauschma.de
blog: 2ality.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110623/1bb69d48/attachment.html>


More information about the es-discuss mailing list