Making "super" work outside a literal?

Brendan Eich brendan at mozilla.com
Sun Jun 19 21:15:58 PDT 2011


On Jun 19, 2011, at 9:13 PM, Axel Rauschmayer wrote:

> It wouldn’t be about stealing, but about setting up an object differently:
> 
> var obj = {
>    foo: function (x) {
>        super.foo(x);
>    }
> };
> 
> === VERSUS ===
> 
> var obj = {};
> obj.foo = function (x) {
>    super.foo(x);
> };
> 
> The <| helps to make that less urgent (I often use Object.create() and then add properties via assignment, to avoid the verbosity of property descriptors).

The assignment form would not work the same way.

Indeed I hope super usage would be an early error in a function that is not directly contained in an ObjectLiteral.

/be

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


More information about the es-discuss mailing list