Brett Andrews (2014-08-06T03:09:50.000Z)
Thanks for your response, Allen. I'm not sure what convincing I can do. To
me it seems odd that `super()` is the same as `super.submit()` but `super`
is not the same as `super.submit`, but perhaps to others that seems
perfectly fine. An alternative to this suggestion would be `super()` should
not be the same as `super.submit()`; and instead `super()` is either
illegal or calls `constructor`.

Brett.


On Wed, Aug 6, 2014 at 11:37 AM, Allen Wirfs-Brock <allen at wirfs-brock.com>
wrote:

>
> On Aug 5, 2014, at 6:06 PM, Brett Andrews wrote:
>
> 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
>
>
> just like:
>         this.submit(); // Invokes ClientForm.submit
>         let thisSubmit = this.submit;  //Reference to ClientForm.submit
>         thisSubmit();   //invokes, but 'thts' in now undefined
>
> This is how properties and method invocations work in JS.  All that the
> use of 'super' does is change the place the property lookup starts.
>  Otherwise 'super' is equivalent to 'this' in the above code.
>
>
>     super(); // Invokes Form.submit
>
> semantically equivalent to
>          super.submit();
> just a short cut
>
>
>     let superSubmit2 = super; // Error: "Unexpected token ;"
>
>
> in some languages, such a unqualified 'super' reference would be
> equivalent to 'this'.
> We intentionally made it an error for that reason.  I perhaps could be
> convinced that it should mean the same as 'super.submit'.
> But in that case,
>     superSubmit2()
> would still not be the same thing as
>     super();
> or
>      super.submit();
>
> Allen
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140806/52287894/attachment.html>
forbes at lindesay.co.uk (2014-08-06T14:13:24.088Z)
Thanks for your response, Allen. I'm not sure what convincing I can do. To
me it seems odd that `super()` is the same as `super.submit()` but `super`
is not the same as `super.submit`, but perhaps to others that seems
perfectly fine. An alternative to this suggestion would be `super()` should
not be the same as `super.submit()`; and instead `super()` is either
illegal or calls `constructor`.