Referencing `super`

Brett Andrews brett.j.andrews at gmail.com
Tue Aug 5 18:06:53 PDT 2014


Some differences/oddities I noticed between referencing and invoking
`super`. I briefly discussed this with Erik Arvidsson at
https://github.com/google/traceur-compiler/issues/1220. In essence, if you
can invoke in two seperate ways, it seems logical that you should be able
to reference in those two ways (super() ~= super.submit(); super !=
super.submit).

```
class ClientForm extends Form{
  submit() {
    super.submit(); // Invokes Form.submit
    let superSubmit = super.submit; // Reference to Form.submit
    superSubmit(); // Invokes, but `this` is now undefined; not sure if
intended

    super(); // Invokes Form.submit
    let superSubmit2 = super; // Error: "Unexpected token ;"
}
```
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140806/62236500/attachment.html>


More information about the es-discuss mailing list