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;
}
```

or ...

```javascript
class A {
  static {
    VALUE = 10;
  }
}
```

as in [redefine.js](https://github.com/WebReflection/redefine#classes)


Both will desugar in

```javascript
function A(){}
Object.defineProperty(A, 'VALUE', {value: 10});
```

leaving the prototype alone with its own different world problems.

My 2 cents




On Thu, Sep 19, 2013 at 7:23 AM, Boris Zbarsky <[email protected]> wrote:

> On 9/19/13 9:30 AM, Rick Waldron wrote:
>
>> class A {
>>    const VALUE = 10;
>> }
>>
>> A decision would have to be made for "const VALUE = 10" here: does it
>> mean mean `A.VALUE` and not `var a = new A(); a.VALUE;`?
>>
>
> The current web platform (and hence WebIDL) answer is "both".  So both
> XMLHttpRequest.UNSENT and XMLHttpRequest.prototype.**UNSENT exist and
> have the same value.
>
> -Boris
>
> ______________________________**_________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to