On 2008-02-05, at 18:53 EST, Brendan Eich wrote: > SpiderMonkey has for about a decade implemented three kinds of > function forms: definitions, expressions, and statements. This is an > example of the last -- it's a function definition, syntactically, > except produced as a child of another statement, possibly even a > block -- a position which the ES3 grammar cannot produce a function > definition. Only if control flow reaches the function statement does > it bind its name. > > This is an extension allowed by ES3 chapter 16.
I would endorse standardizing this behavior. FWIW, the Openlaszlo compiler/translator extends es3 in a similar fashion to support conditional compilation. An `if` that tests a compile-time constant will be optimized away by the compiler. _______________________________________________ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss