Why can't we `let s = super`?

Don Griffin don at sencha.com
Sat Feb 18 05:24:34 UTC 2017


It seems like in the r-value usage there it could just evaluate to the
method's "HomeObject" no? That would be really useful in cases where the
value supplied to "extends" is complex.

Best,
Don
--
Don Griffin
Director of Engineering
Sencha, Inc.
https://www.sencha.com/

On Fri, Feb 17, 2017 at 11:11 PM, Logan Smyth <loganfsmyth at gmail.com> wrote:

> `super()` right now is a special syntactic feature, just like the new
> proposed `import()` and such. To have `super` behave like a variable and be
> consistent, `super.foo()` would also then be accessing a property on that
> variable, instead of calling a method from the parent constructor
> prototype. Then a whole new approach would be needed for parent class
> access.
>
>
> On Fri, Feb 17, 2017 at 7:45 PM, /#!/JoePea <joe at trusktr.io> wrote:
>
>> Why can't we store a reference to `super`? It seems counterintuitive and
>> prevents possible things like
>>
>> ```js
>> function metaStuff(sup) {
>>   // do something else with super or with `this`
>> }
>>
>> class Bar extends Foo {
>>   constructor() {
>>     let s = super
>>     s()
>>     metaStuff(s)
>>   }
>> }
>> ```
>>
>>
>> */#!/*JoePea
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170217/215c8774/attachment.html>


More information about the es-discuss mailing list