name property for built-in functions??
Mark S. Miller
erights at google.com
Fri Mar 6 09:12:19 PST 2009
On Thu, Mar 5, 2009 at 11:18 PM, Brendan Eich <brendan at mozilla.com> wrote:
> A function object (remember joined function objects in ES3?) created from
> the compiler-created immutable-shared function may or may not have a name
> property in the proposal, but calling toString on a function object created
> (to form a closure) should not, in my opinion, get the value of the "name"
> property of that particular (or any other) closure object.
> Setting the name of the compiler-created function by assigning a property to
> one of N (N>=1) unjoined function objects could be done. No more "immutable"
> but the "shared" still applies. I do not favor this, but it could be done. I
> suspect the Obj-J folks want it.
I strongly object. Such sharing of state, enabled only by sharing the
same function literal in the code, violates all notions of state
isolation. It presents all the same hazards that the ES3 sharing of
mutable RegExp literal objects had. The current draft spec repairs all
such leaks. Let's not introduce another.
More information about the Es-discuss