"Pretty" function expression names

P T Withington ptw at pobox.com
Mon May 4 14:00:49 PDT 2009


On 2009-05-04, at 14:46EDT, Brendan Eich wrote:

> On May 4, 2009, at 10:45 AM, P T Withington wrote:
>
>> Assuming we're allowed to speculate on futures here...
>>
>> I was thinking about improving debug-ability by adding descriptive  
>> names to function expressions thusly,
>>
>> var myFun = function "my description here" (...) { ... };
>
> Is this better for your purposes than
>
> var myFun = function (...) { ... };
> myFun.prettyName = "my description here";

Just that it's shorter and easier to type.  It would be a shorthand  
notation for setting the .name property of the function object  
created.  I wouldn't expect the function to be referenceable by the  
name, but I'd want Function.toString to display it (as a string  
literal).




More information about the es-discuss mailing list