Re: Function declarations as statements

2010-11-11 Thread Mark S. Miller
On Thu, Nov 11, 2010 at 5:37 PM, Garrett Smith wrote: > On 11/11/10, Michael Day wrote: > > Hi Brendan and Allen, > > > > Thanks for the pointers. > > > >> So for Harmony, we are reclaiming function in block (must be a direct > >> child of a braced block) to bind a block-local name on block entry

Re: Function declarations as statements

2010-11-11 Thread Garrett Smith
On 11/11/10, Michael Day wrote: > Hi Brendan and Allen, > > Thanks for the pointers. > >> So for Harmony, we are reclaiming function in block (must be a direct >> child of a braced block) to bind a block-local name on block entry (so >> hoisting lives, but only to top of block -- so you can't emul

Re: Function declarations as statements

2010-11-11 Thread Mark S. Miller
mike...@yeslogic.com] > > Sent: Thursday, November 11, 2010 4:48 PM > > To: Brendan Eich > > Cc: ES-Discuss; Allen Wirfs-Brock > > Subject: Re: Function declarations as statements > > > > Hi Brendan and Allen, > > > > Thanks for the pointers. > >

RE: Function declarations as statements

2010-11-11 Thread Allen Wirfs-Brock
Michael Day [mailto:mike...@yeslogic.com] > Sent: Thursday, November 11, 2010 4:48 PM > To: Brendan Eich > Cc: ES-Discuss; Allen Wirfs-Brock > Subject: Re: Function declarations as statements > > Hi Brendan and Allen, > > Thanks for the pointers. > > > So for Harmony, we

Re: Function declarations as statements

2010-11-11 Thread Michael Day
Hi Brendan and Allen, Thanks for the pointers. So for Harmony, we are reclaiming function in block (must be a direct child of a braced block) to bind a block-local name on block entry (so hoisting lives, but only to top of block -- so you can't emulate with var f = function ...). If we impl

RE: Function declarations as statements

2010-11-11 Thread Allen Wirfs-Brock
han trivial usage is unlike to be interoperable. Allen > -Original Message- > From: es-discuss-boun...@mozilla.org [mailto:es-discuss- > boun...@mozilla.org] On Behalf Of Michael Day > Sent: Thursday, November 11, 2010 3:46 PM > To: ES-Discuss > Subject: Function decla

Re: Function declarations as statements

2010-11-11 Thread Brendan Eich
sted > inside a block. > > However, browsers support function declarations as statements, and many > scripts on the web seem to make use of this ability, especially after they > have been minified. > > Is there a spec anywhere for how functions as statements should behave? &

Function declarations as statements

2010-11-11 Thread Michael Day
Hi, In ECMAScript, function declarations are SourceElements, but not Statements. This means that they can only occur at the top level, and may not be nested inside a block. However, browsers support function declarations as statements, and many scripts on the web seem to make use of this