ES4 stable draft: object initializers

Waldemar Horwat waldemar at google.com
Tue Apr 15 16:38:41 PDT 2008


My comments:


The grammar doesn't work:

{meta::prototype:17}
can be parsed as either a FieldName or as the meta::prototype production.  To make parsing unambiguous you can't allow "meta" to be included in AnyIdentifier (or implement some other similar fix).


Class type discussion:

Do the properties in the literal need to have any correspondence to the members of the class?  As far as I can tell, they can be anything.


> If a property name in the record type that annotates the literal

What record type?  You didn't say that the type has to be a record type here.


> If a literal field is annotated by |const| or |var| and the field is 
> also named in the record type that annotates the literal then the type 
> of the property is the type given in the record type, not the type 
> implied by the initial value of the property (see below).

This paragraph is misplaced.  Instead, fix the descriptions of const and var below, as they lead to the wrong conclusion in this case without any hints that they're overridden here.


What is the type of fields without a type annotation?


    Waldemar



More information about the Es4-discuss mailing list