Comma-separated instance field definitions

T.J. Crowder tj.crowder at farsightsoftware.com
Mon Oct 8 16:57:55 UTC 2018


TL;DR: Comma separated instance field definitions: In or out? (Currently
out, but is that decided or still up in the air?)

Verbose: In the short "Changes vs previous proposals" list at the end of
the [class fields proposal][1], it says:

> Comma-separated multiple definitions: These are visible in the
> above example of class C, and are analogous to comma-separated
> definitions from var, let and const. They may be immediately
> useful when declaring multiple static fields, but later are
> useful in conjuction with decorators.

The `C` example above it doesn't have any comma-separated definitions,
though; it looks like they were removed in Nov 2017 by [this commit][2].

The spec text matches with the edit (no comma-separating), and Node.js v10
with `--harmony-class-fields` and Babel both also align with that.

So all that suggests there won't be comma-separation for instance fields,
am I getting that right? Or is there something in the works? (I don't see
any benefit to comma separation for instance fields other than if the
static fields proposal allowed them [to avoid repeating `static`], which it
doesn't at the moment AFAIKS, it would make sense for the syntaxes to
align, I'm just curious where the syntax is headed.)

-- T.J. Crowder


[1]: https://github.com/tc39/proposal-class-fields
[2]:
https://github.com/tc39/proposal-class-fields/commit/4bfde40926d303694b7acd071c13a610ffa1a272
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20181008/73a5e376/attachment.html>


More information about the es-discuss mailing list