On May 4, 2009, at 2:00 PM, P T Withington wrote:
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).
As Michael Haufe and Mike Wilson point out, this might leave some
wanting to call the function by that name within its own body. I'm
interested in why you wouldn't care about that use case -- because you
can guarantee that myFun never varies?
An intrinsic name for toString and reflection is a fine thing, but
people tend to expect functions with names to be callable in some
scope. There's the rub.
I'm adding strawman and harmony pages to the wiki based on existing
discussions, so I'll roll up the function name proposal thread and add
this item. Thanks.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss