name property for built-in functions??

Brendan Eich brendan at
Fri Mar 6 14:27:51 PST 2009

On Mar 6, 2009, at 12:41 PM, Garrett Smith wrote:

> On Fri, Mar 6, 2009 at 9:48 AM, Brendan Eich <brendan at>  
> wrote:
>> No, sorry -- no time. What's your point? If you see something worth
> My point? If you had read the source code, then you might have reason
> for waiting to hear from the objective-j folks to make a decision on
> [[Writable]] name. What could the reason be?

I am waiting to hear from them. Are you reading what I'm writing? Yeesh.

No decision is being rushed here, but the point against mutable named- 
function name property (both "named" and "name" are necessary in that  
phrase) on which Mark and I agree stands independently of other  
arguments. It might lose (I hope not), but it's fair to make now,  
independently from any other correspondence on this topic. It is an  
apple to any countervailing orange.

Now, I like apples better than oranges, perhaps Mark does too, but the  
isolation argument that Mark emphasized is not just a matter of taste.  
Just as an apple may be objectively more healthy to the average or  
majority-demographic constitutional type, immutable function name may  
be measurably more secure, or more efficient (both, I'd argue).

The utility of mutable name for anonymous functions is not at issue if  
we do not define name at all on such functions -- this is the proposal  
Allen and I were converging on. You can set name on such anonymous,  
expressed functions to whatever value you like, delete it, shadow it  
via .prototype/construction, etc.

The only issue remaining in this anonymous function case is whether  
toString picks up the assigned name. For anonymous functions only,  
this could be done without breaking the isolation property that  
allowing mutation of the name initialized from the declared name of a  
non-anonymous function would break. In fact it would seem independent:

anonymous function referenced by variable f:
   * name can be set;
   * if set to a value converting to the string "g", then f.toString()  
returns "function g(...) {...}" (modulo whitespace).

named function expression or declaration, name is f:
   * name cannot be set, deleted, or configured;
   * f.toString() always returns a string starting "function f(...".

Does this help?

> ...
> Good stuff.

Off topic, too. If the goal is to hear from the Objective-J folks, let  
them speak on the particular issue of mutable function name property.  
General hype just adds noise and makes me grumpy. Let's talk about the  
specific costs and benefits of function name property as proposed. And  
yeah, I'd love to hear more about the Objective-J use-case.


More information about the Es-discuss mailing list