Referencing `super`

Rick Waldron waldron.rick at gmail.com
Wed Aug 6 12:25:42 PDT 2014


On Wed, Aug 6, 2014 at 3:03 PM, Brendan Eich <brendan at mozilla.org> wrote:

> Rick Waldron wrote:
>
>>
>>     I'm cool with super() in methods, I forgot we disallowed naked
>>     `super`, and my gut says we would support it as equivalent to `this`.
>>
>>
>> To clarify, you don't mean `super === this`, right?
>>
>
> The alternative is for bare `super` to denote the same-named superclass
> method bound to `this`. That enables the equivalence Allen wrote based on
> Brett's error citation:
>
>
>     let superSubmit2 = super; // Error: "Unexpected token ;"
>     superSubmit2(); // if no Error, this is equivalent to super()
>
> But that breaks the other equivalence:
>
>     super.method();  ====  do { let s = super; s.method(); }
>
> So you can see why bare `super` is currently illegal! (Want a better error
> message than the one Brett showed.)
>

Yes, this is/was all clear (and I stand on the side of keeping bare super
illegal), I was just curious about what your gut was saying ;)

Agree that a more explicit early error would be ideal.

Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140806/39c41299/attachment.html>


More information about the es-discuss mailing list