static/class properties

Rick Waldron waldron.rick at gmail.com
Thu Sep 19 10:36:04 PDT 2013


On Thu, Sep 19, 2013 at 1:14 PM, Andrea Giammarchi <
andrea.giammarchi at gmail.com> wrote:

> I cannot remember if that has been considered historically a Java or PHP
> error/ambiguity ... I'd rather not repeat that in ES6.
>
> A Class constant should have nothing to do with instances but instances
> can have properties that returns that class constant, if needed.
>
> We've got new syntax here so I say this is the easier to
> read/write/understand ... no need a big chapter explaining what's going on
> ^_^
>
> ```javascript
> class A {
>   static A.VALUE = 10;
> }
> ```
>

But this doesn't match the existing:

class A {
  static foo() {
     return "Returned from a class-side method";
  }
}

Means: A.foo()

And it's still possible to add:

class A {
  static VALUE = 10;
}

Sometime in the future


>
>
> or ...
>
> ```javascript
> class A {
>   static {
>     VALUE = 10;
>   }
> }
> ```
>

This is nice but conflicts with the existing `"static" MethodDefinition`
form

Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130919/caf82842/attachment.html>


More information about the es-discuss mailing list