name property for built-in functions??

Maciej Stachowiak mjs at
Sat Mar 7 17:07:45 PST 2009

On Mar 5, 2009, at 11:18 PM, Brendan Eich wrote:

> On Mar 5, 2009, at 9:26 PM, Allen Wirfs-Brock wrote:
>>> In their code generation scheme, do they ever require the generated
>>> function to have a particular non-global scope, or will global  
>>> scope do?
>> Are you really talking about "scopes" in the formal language sense  
>> here?
> Yes -- does Objective-J generate lambdas in other functions which  
> refer to lexically scoped variables in enclosing functions. At least  
> one Ajax library I know of (EXT) does this using eval.

I think they only care about new Function() constructed functions. At  
least, this was the focus of the discussion I had with them.

For what it's worth - they only really need the ability to set the  
name once, not to mutate it multiple times. So if making the property  
mutable for everything seems distasteful, I think an alternate  
function constructor that lets you provide a name (which is thereafter  
immutable) would be an adequate solution. I would prefer that to  
sometimes having a read-only name property and sometimes not. For  

Function.create("[Foo bar]", "param1", "param2", "code(); goes();  

This would allow us to retain the name "anonymous" for functions  
created without providing a name.


More information about the Es-discuss mailing list