name property for built-in functions??

Brendan Eich brendan at
Sat Feb 28 21:59:43 PST 2009

There is long-standing precedent for the plain identifier:


What should (new Function).name or (equivalently) Function().name  
return? Precedent in some engines:

js> (new Function).name

An anonymous function expression returns the empty string in some  

js> (function(){}).name

js> typeof (function(){}).name
js> (function(){}).name.length


(Is "printString" a VB-ism? ;-)

On Feb 28, 2009, at 6:31 PM, Allen Wirfs-Brock wrote:

> Because we have introduced a “name” property for function objects we  
> have to specify what values the built-in functions in Section 15  
> each have for this property.  Note that the value of this property  
> is intended to be a descriptive name and is not necessarily a simple  
> identifier.  We have already taken advantage of this in specify the  
> “name” of functions created using Function.prototype.bind.
> So what should name property values  be for a built-in function such  
> as Array.prototype.printString?  The straight forward thing to do is  
> to say it is “printString”.  However, it would be potentially more  
> useful for debugging purposes if it was “Array.prototype.printString”.
> Thoughts?  I’m probably going to specify that simple identifier  
> unless I hear a strong response in favor of using the fully  
> qualified name.
> Allen
> _______________________________________________
> Es-discuss mailing list
> Es-discuss at

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Es-discuss mailing list