On Aug 17, 2007, at 3:37 PM, Brendan Eich wrote:
> On Aug 17, 2007, at 1:10 PM, Garrett Smith wrote:
>
>> what is the difference between x1 and x2?
>>
>> class A {
>> const x1;
>> static final x2;
>
> You need a var before x2. Also you can't add final except before
> classes and methods (the reference implementation currently parses
> 'class A { static final var x; }' but that's a bug).
>
> Are you thinking of Java, or some other language here? If this is
> based on an ES4 example or spec, can you cite the URL?
>
> The obvious difference, ignoring the intended illegality of static
> final var x2, is that x2 is static, so per class, not per instance.
I should add that const is write-once, so you can have a const x1
instance field. A constructor could write three different values to
three different instances' x1 fields. In this case const does not
mean per-class, as static const does, or a hypothetical static final
var might.
/be
_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss