object literal types

Michael Haufe TNO at TheNewObjective.com
Tue Feb 17 16:15:52 PST 2009


Brendan Eich wrote:
> On Feb 17, 2009, at 5:07 AM, Michael Haufe wrote:
>
>> David-Sarah Hopwood wrote:
>>
>>> "':' (not '=') is used to separate a property name from its value, 
>>> so it
>>> can't also be used for type annotations."
>>
>> Except in the case of JavaScript's non-standard Sharp Variables 
>> (https://developer.mozilla.org/En/Sharp_variables_in_JavaScript),
>
> Sharp variables (which I modeled after Common Lisp) are different 
> syntax -- their = sign comes *before* the object-type property value 
> or outermost object or array initialiser, and the = is preceded by the 
> sharp variable name. Also, you can't have any spaces between #n and = 
> (for non-negative integer n). There's really no comparison with the 
> syntax you sketched.
>
>
>> which is what sparked my question.Is there some ambiguity on why this 
>> syntax reuse would be off the table?
>
> Yes, there is an ambiguity. See the grammar:
>
> PropertyNameAndValueList:
>      PropertyName ':' AssignmentExpression
>      PropertyNameAndValueList ',' PropertyName ':' AssignmentExpression
>
> /be
>
>
>

Just the explanation I was looking for, thanks!



More information about the Es-discuss mailing list