Minimalist Classes

Erik Arvidsson erik.arvidsson at gmail.com
Tue Nov 1 20:03:03 PDT 2011


On Tue, Nov 1, 2011 at 19:32, Brendan Eich <brendan at mozilla.com> wrote:
> On Nov 1, 2011, at 7:17 PM, Quildreen Motta wrote:
>
>> There's `public', but then, that's quite verbose. I guess people comming from a classical language with declarative definitions for class slots might still be used to it, none the less.
>
> I thought of that, but then 'public const'? Muy Verboso!

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

-- 
erik


More information about the es-discuss mailing list