Strict mode recap

Brendan Eich brendan at mozilla.org
Thu Apr 10 20:44:38 PDT 2008


On Apr 10, 2008, at 8:30 PM, Jon Zeppieri wrote:

> On 4/10/08, Jon Zeppieri <jaz at bu.edu> wrote:
>>
>>     var o = { null var count = 100, ... };
>
> Sorry:  two syntactic mistakes, here, one of which is interesting.
> The boring one is my use of '=' rather than ':'.
>
> But after reading the object initializer draft, I see that, if the
> intent of the above were legal, the syntax would be:
>
> var o = { var null::count: 100 };
>
> Is it still the case that instance variables in classes are defined  
> like:
>
> public var count = ...
>
> If so, why the difference (discounting the colon/equal part, that is)?

Part of the answer (enough for me) has to be that we want to support

   var o = { iterator::get: ... }

without var in front of the property name. Not { iterator get: ... }  
which is too spacey and similar to { get foo() ... } and other  
special forms involving contexual keywords we don't want to preempt  
from being namespace names.

Composing var in front with ns:: before identifier and you get the  
unclassy { var ns::foo: ... }. Something has to "give" here -- either  
ns var foo wins leaving us with ns foo (the var-free case of a  
namespace-qualified property name) or it loses and we have what is  
proposed.

/be




More information about the Es4-discuss mailing list