Making "super" work outside a literal?

Brendan Eich brendan at mozilla.com
Sat Jun 25 14:44:03 PDT 2011


On Jun 25, 2011, at 2:37 PM, Axel Rauschmayer wrote:

>>   D = (function() {
>>     __extends(D, B);
>>     function D(x, y) {
>>       D.__super__.constructor.call(this, x);
>>       this.y = y;
>>     }
>>     D.prototype.m = function(z) {
>>       return 1 + D.__super__.m.call(this, z);
>>     };
>>     return D;
>>   })();
> 
> 
> I wonder if using an IIFE isn’t counter-productive here:
> - D.__super__ refers to the binding of D inside the IIFE which means that the IIFE environment is will be kept alive.

It's no big deal. OTOH leaking the name seems like it could cause trouble.

/be
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110625/735101ec/attachment.html>


More information about the es-discuss mailing list