Should I be able to apply `new`?
Jeff Walden
jwalden+es4 at MIT.EDU
Fri Apr 6 06:53:02 PDT 2007
P T Withington wrote:
> Suppose I have a function that wants to be able to construct
> arbitrary objects and manipulate them:
>
> function maker () {
> var o = new arguments[0].apply(?, arguments.slice(1));
> ...
> return o;
> }
>
> The syntax does not allow for this. Should it?
I'd thought to do that you'd do something like this (don't have time to spec-verify at the moment, but this is in the right vein at least):
> function maker () {
> var o = arguments[0].intrinsic::construct.apply(null, arguments.slice(1));
> ...
> return o;
> }
The |null| is purely a guess; I suspect whatever's actually there is ignored.
Jeff
--
Rediscover the Web!
http://snurl.com/get_firefox
Reclaim Your Inbox!
http://snurl.com/get_thunderbird
More information about the Es4-discuss
mailing list