I really hope that “let is the new var” will hold and won’t be replaced with 
“let is the new var, except for class declarations and global variables”.

One more possibility (in addition to not writing anything at all and using let 
instead of var):
class C {
    public x = 0, y = 0; // the analog to private
    const foo = "abc";
}

Two more thoughts:
- We are becoming more verbose than object literals (with either var or 
public). I had hoped that we could preserve their lightweight spirit.
- How often will one define non-function prototype properties? It could even be 
considered an anti-pattern. That might make it easier to decide on verbose 
syntax.

> I also prefer var since it fits better with const.
> 
> class C {
>  var x = 1;
>  const y = 2;
>  ...
> }
> 
> is better than
> 
> class C {
>  x = 1;
>  const y = 2;
>  ...
> }
> 
> Another problem with skipping var (which we saw in Traceur) was that
> without both var and initializer it looks really strange.
> 
> class D {
>  z;
>  ...
> }

-- 
Dr. Axel Rauschmayer
[email protected]

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com



_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to