ES4 draft: Function

Dominic Cooney dominic.cooney at
Thu Mar 13 10:48:56 PDT 2008

Why doesn't Function have something like apply that does the same as
in a new expression, i.e. allocate-init-and-apply? To put it another
way: given arguments in an array, I want to write:

F.thisThing(args) and have it mean the same as new F(args[0], args[1],
... args[n-1])

Or is what happens behind the veil of object creation detailed enough
that I can write a facsimile of it with apply? I guess something like:

var x = {};
x.prototype = F.prototype;
x = F.apply(x, args) || x;

But why force me to guess? No doubt I am wrong.


On Mon, Mar 10, 2008 at 7:38 PM, Jon Zeppieri <jaz at> wrote:
> On 3/10/08, Lars Hansen <lhansen at> wrote:
>  > First draft of the spec for the Function class.  Please comment.
>  >
>  Suggestion: deprecate the Function constructor and static invoke().
>  Almost all of its uses are better handled by function expressions and,
>  in those cases where eval() in required, one can use eval().
>  -Jon
> _______________________________________________
>  Es4-discuss mailing list
>  Es4-discuss at

More information about the Es4-discuss mailing list