function hoisting like var

Ingvar von Schoultz ingvar-v-s at
Sun Jul 27 16:51:24 PDT 2008

Igor Bukanov wrote:
> 2008/7/28 Ingvar von Schoultz <ingvar-v-s at>:
>> I wonder if people would like using them.
> Anything that is available in a browser will be used and abused ;).

Wonderful! My notation will become popular! :-D

>>> Any of this can be a valid ES3 code as [] always means an array literal.
>> I get the impression that disambiguation would be easy.
> eval('[]') is a valid and, in fact, useful ES3 code. Similarly eval('{[]}').

Yes, and by my rules they both create and return a new, empty
array, which is intuitively expected and compatible.

When I said that an array is a comma-separated list of values,
the fact that I left out the empty and the single-value cases
didn't mean that they should be seen as blocks! I just didn't
want to write a lengthy, exhaustive full grammar...

I get the impression that the parser always must start out
assuming it's a literal, and backtrack if the syntax doesn't
fit. The only exception would be at a spot where a literal
isn't possible while a block is possible, but I don't think
any such spot is possible.

Ingvar von Schoultz

------- (My quirky use of capitals in code comes from my opinion that
reserved and predefined words should all start with lowercase, and
user-defined should all start with uppercase, because this will easily
and elegantly prevent a host of name-collision problems when things
like programming languages are upgraded with new labels.)

More information about the Es4-discuss mailing list