Why can't we `let s = super`?
# Logan Smyth (8 years ago)
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.
# Don Griffin (8 years ago)
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. www.sencha.com
Why can't we store a reference to
super
? It seems counterintuitive and prevents possible things likefunction metaStuff(sup) { // do something else with super or with `this` } class Bar extends Foo { constructor() { let s = super s() metaStuff(s) } }