I like most of what you just proposed, except that I find it surprising that a function's ".name" is not the identifier used by ".toString()" on that function. This same issue just came up on an internal list at Google: Objecting that since ES3.1 specs that the ".name" for bound functions and literal getters and setters is not an identifier, it would break .toString() if it were used in the identifier position of a function's .toString().
On Tue, Mar 3, 2009 at 7:35 PM, Allen Wirfs-Brock < [email protected]> wrote: > A quick post-script. We could also give > Function.prototype.name<http://function.prototype.name/>a different name, > perhaps "identifier" if we don't want to trample over the > existing FF and Chrome implementations. Too bad "name" is such a good name > for this functionality. The other way to reconcile this is to retreat to keeping the name "name", but having it always agree with the identifier used the function's .toString(). If we do this, then we should choose a good enough identifier mangling scheme for bound functions ("bind_<original-ident>") and literal getters and setters ("get_<ident>", "set_<ident>"), and use it in both the .name and in the identifier position of .toString(). Ugly as this is, I think it's better than having two different names associated with the same function by two different parts of our API merely because we couldn't agree on one. -- Cheers, --MarkM
_______________________________________________ Es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

