ES4 draft: Function
lhansen at adobe.com
Tue Mar 11 07:49:04 PDT 2008
> -----Original Message-----
> From: zeppieri at gmail.com [mailto:zeppieri at gmail.com] On
> Behalf Of Jon Zeppieri
> Sent: 10. mars 2008 20:39
> To: Lars Hansen
> Cc: es4-discuss Discuss
> Subject: Re: ES4 draft: Function
> On 3/10/08, Lars Hansen <lhansen at adobe.com> 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().
I think there are three points to be made here. The first is
that the Function constructor provides functionality that
eval does not, namely, creating new functions that are closed
in the global environment only. Erik made the
argument that this is sometimes useful; I agree.
The second point is about deprecation. TG1 has had a difficult
time with deprecation in general. It is not clear that
deprecation means anything on the web, except /maybe/ in the
very long term. The fact that we deprecate something has
no bearing on existing content, and new engines will need
to support old behavior. So though TG1 finally (on my
insistence) deprecated the arguments object, it was with
a shrug, and it would be surprising to me if the deprecation
clause makes it into the final spec, as it has no real impact.
(I actually wanted to remove the arguments object from ES4
so that ES4-only implementations would not have to implement
it at all, to be replaced by rest arguments and "this function".)
The third point is, why deprecate that particular functionality?
It's not like it costs much at all in terms of spec space or
implementation complexity. Eval already requires hooks into a
run-time compiler, which is where the heavy lifting goes.
More information about the Es4-discuss