static/class properties

Andrea Giammarchi andrea.giammarchi at gmail.com
Thu Sep 19 11:10:10 PDT 2013


Just some thought about the natiral following option:

```javascript
class A {}

const A.{
  VALUE = 10;
  METHOD = function () {};
  THOUGHTS = '?';
}
```

Cheers


On Thu, Sep 19, 2013 at 11:08 AM, Andrea Giammarchi <
andrea.giammarchi at gmail.com> wrote:

> the A.whatever is explicit to the class so it's the less ambiguous, IMO
>
> I see already confusing to understand if properties will be defined in the
> instance or in the class ... could not tell easily while I could, reading
> `A.VALUE = 10;` instead.
>
> Anyway, using that outside the class definition as:
>
> ```javascript
> class A {
>   // do whatever in here ...
>   // that you want inherited/assigned too
> }
> const A.VALUE = 10;
> ```
>
> is already good, if possible, and ambiguity free (but I cannot remember
> the `const obj.prop = value;` state)
>
> Hopefully in that way instances won't inherit a thing for sure ^_^
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130919/0c9cd9c9/attachment.html>


More information about the es-discuss mailing list