On Thu, Mar 5, 2015 at 5:46 AM, Brian Blakely <[email protected]>
wrote:

> I just want public and protected properties, as well as data properties.
>
> After those, class and I are buddies.
>
>
 I observed on Twitter that data properties can be hammered in surprisingly
tersely, even without mixins:
```
let C = Object.assign(class {
  method1(){}
  method2(){}
  get accessor1(){}
  get accessor2(){}
}.prototype, {
  dataProperty: 1,
  dataProperty: 2,
}).constructor;
```
That is, if you don't mind them being enumerable, or that Symbol-keyed
properties aren't included. :P

I do, however, have a small personal grievance about the class syntax: why
doesn't it use commas to separate method and accessor properties? Consider
the disconnect. Object literal: commas. Array literal: commas. Class
literal: no commas. I appreciate that classes are not literals in quite the
same sense, in that they aren't really a list of properties that are
assigned to a single object, but it still seems quite un-Javascryptic to
have property after property with no commas between.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to