Re: ES4 draft: array initializer expressions
I have a (perhaps stupid) question regarding the Array type syntax. What is the use case for a type like: [string, double, ...boolean] I understand the utility of heterogeneous tuples of a fixed size, and of homogeneous lists of variable size, but I don't really see when I would use a hybrid like this. What am I missing? regards Olav Junker Kjær ___ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss
Re: ES4 draft: array initializer expressions
'var' and 'const' need to be added to the lookahead set on ExpressionStatement. That will take care of the ambiguity. Jd On 4/15/08 5:08 PM, Waldemar Horwat wrote: > My comments: > > > The grammar is ambiguous. > > var [x, y] = expr; > > is both an assignment expression statement and a destructuring variable > binding statement. > > > How does the "length" property work for structural type literals? Is it > always a fixture? > > >> If the array initializer is prefixed by |const| or |var| then the array >> properties created will be created as fixtures; if the prefix is |const| >> those fixtures will additionally be read-only. > > Am I to read this as stating that the length is also a constant if "const" is > used? It's a bit unclear. > > > Waldemar > ___ > Es4-discuss mailing list > Es4-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es4-discuss ___ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss
Re: ES4 draft: array initializer expressions
My comments: The grammar is ambiguous. var [x, y] = expr; is both an assignment expression statement and a destructuring variable binding statement. How does the "length" property work for structural type literals? Is it always a fixture? > If the array initializer is prefixed by |const| or |var| then the array > properties created will be created as fixtures; if the prefix is |const| > those fixtures will additionally be read-only. Am I to read this as stating that the length is also a constant if "const" is used? It's a bit unclear. Waldemar ___ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss