name property for built-in functions??

Jeff Watkins watkins at apple.com
Wed Mar 4 13:38:29 PST 2009


Can I suggest that allowing writing to name may be helpful when  
creating transparent wrapper functions?

We do a lot of this:

function wrapWithChangeNotification(key, fn)
{
	return function()
	{
		this.willChangeValueForKey(key);
		var result= fn.apply(this, arguments);
		this.didChangeValueForKey(key);
		return result;
	}
}

I'd love it if I could set the name on the new function to match the  
original function.

On 4 Mar, 2009, at 1:17 PM, Brendan Eich wrote:

> Why in the world is name writable?
>
> js> function f(){}
> js> f.name
> f
> js> f.name = 'g'
> g
> js> f.name
> f
>



More information about the Es-discuss mailing list