Function declarations in statements

liorean liorean at gmail.com
Sat Mar 17 07:23:21 PDT 2007


On 17/03/07, Igor Bukanov <igor at mir2.org> wrote:
> On 17/03/07, Igor Bukanov <igor at mir2.org> wrote:
> > For me JScript behavior is in fact more consistent. There both var and
> > function statement is executed on the function entrance no matter
> > where they are placed.
>
> This also suggest a more reasonable behavior than the current mess:
>
> Make a function statement to define its name as a local variable for
> the whole function/script it exists in in the same way as the var
> statement does but execute their declarations at the entrance of the
> block they are defined in.

[snip]

> With this rule the function statements inside blocks are no longer
> special compared with top-scope definitions and consistent with the
> var behavior. It should also be compatible with SpiderMonkey behavior
> in reasonable programs.

In fact, that is exactly what I mean when I talk about run time
instantiation. I never asked for you to specify that declaration takes
place at run time, in fact that would be inconsistent with the other
declarations, only that you delay instantiation (or perhaps it's
simply assignment in this case) of the function object to the
variable.
-- 
David "liorean" Andersson



More information about the Es4-discuss mailing list