On Mon, Mar 14, 2011 at 12:06 PM, Bruno Jouhier <[email protected]> wrote:

> Is this behavior precisely defined by the ECMAScript standard, or is
> it left open to interpretation?
>

Enter Yuri or Dmitry ;)

The simple answer is that yes, the ECMA standard specifically specifies that
function declarations cannot occur inside statements (so not within an if).
As far as the standard goes, there is no such thing as a "Function
Statement". Browsers have a different take on this and will still accept it.
But since it's not supported by the standard, your mileage will vary.

The specification correct way of handling function declarations within
statements would be to throw an error at parse time.

Both Yuri (kangax) and Dmitry have written extensive articles on this
matter, I'm sure somebody will post them :)

- peter

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to