Function()

Garrett Smith dhtmlkitchen at gmail.com
Fri Sep 5 23:35:05 PDT 2008


On Fri, Sep 5, 2008 at 11:12 PM, liorean <liorean at gmail.com> wrote:
> 2008/9/6 Garrett Smith <dhtmlkitchen at gmail.com>:
>> I have a question about the Function constructor algorithm:
>>
>> 1. Let P be the empty string.
>> 2. If no arguments were given, let body be the empty string and go to step 13.
>>
>> Would it be OK to just use:-
>>
>> 2. If no arguments were given, return a function as specified in 13.2.
>>
>> The resulting function would be indistinguishable.
>
> The ECMAScript spec only defines programatically distinguishable
> behaviour. As long as the behaviour is indistinguishable from the spec
> the underlying behaviour of the engine can be whatever is decided upon
> by the engine devs.

Hmm. Yeah.

The scope property would be the global object, but that would also
seem to unobservable for an empty function.

The current wording describes a solution that is less than optimal,
and actually describes the step of creating an empty string for this
situation. It is verbose about something that would probably otherwise
be implemented more efficiently by engine devs.

Garrett

> --
> David "liorean" Andersson


More information about the Es-discuss mailing list