Referencing `super`

Brett Andrews brett.j.andrews at gmail.com
Wed Aug 6 16:38:56 PDT 2014


I don't think we need to do any special binding to `this` for bare `super`.
Perhaps it will help if I provide the original use case that led me to
this. I'm using AngularJS and declaring controllers as classes. I have a
base FormCtrl that extends (for example) a ClientFormCtrl. The cut-down
version of the constructor is this:

constructor($injector) {
  $injector.invoke(super, this, {
    formName: 'activityUpsertForm'
  });
}

In this case, I don't care what `super` is bound to, since under the covers
Angular is going to do super.apply(this).

I think the most obvious and least confusing/breaking way for `super` to
function is for it to be the equivalent of `let super = super.[method_name]`


On Thu, Aug 7, 2014 at 5:54 AM, Brendan Eich <brendan at mozilla.org> wrote:

> Rick Waldron wrote:
>
>> I was just curious about what your gut was saying ;)
>>
>
> I was going for alias to `this`. But that argues against `super()` as
> short for `super.method()` in method context. And that means Java, so bleah
> :-P.
>
>
> /be
> _______________________________________________
> 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/20140807/bf9abd02/attachment-0001.html>


More information about the es-discuss mailing list