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

Logan Smyth loganfsmyth at gmail.com
Sat Feb 18 05:11:44 UTC 2017


`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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170217/f6701745/attachment.html>


More information about the es-discuss mailing list