Sep 27 meeting notes

Bob Nystrom rnystrom at google.com
Wed Sep 28 11:07:15 PDT 2011


On Tue, Sep 27, 2011 at 10:30 PM, Brendan Eich <brendan at mozilla.com> wrote:

> On Sep 27, 2011, at 4:06 PM, Waldemar Horwat wrote:
>
> > Trying to understand Oliver's objections to the current class proposal.
>
> Oliver objects, as do others, to "punning" (my word) declarative syntax to
> define object properties, and mixing static and dynamic influences. He
> specifically cited the location of public exportable-definitions in the
> constructor body, instead of in the class body.
>
> We then discussed how putting public x,y; for a class Point in the class
> body requires separate assignments in the constructor body.


At some point, didn't we discuss borrowing a bit from CoffeeScript and
supporting this shorthand:

  class Point {
    public x, y;
    constructor(this.x, this.y) {} // <-- assigns args to instance fields
  }

If we were feeling crazy, we could go further (similar to Scala) and allow:

  class Point {
    constructor(public x, public y) {}
  }

That gives you a declarative form, constructor argument, and initialization
all in one place.

- bob


> Without type annotations (guards) the public declaration is easy to leave
> out -- it seems optional or unnecessary. And in the case of const (public
> const K) there's no way to initialize with a constructor parameter or other
> per-construction state. Anyway, this was the counter-argument, heard before.
>
> Oliver, anything to add?
>
> /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/20110928/dcf33098/attachment.html>


More information about the es-discuss mailing list