name property for built-in functions??
brendan at mozilla.com
Thu Mar 5 17:40:09 PST 2009
On Mar 5, 2009, at 5:34 PM, Maciej Stachowiak wrote:
> The authors of Objective-J and the Capuccino framework have asked us
> to either make Function.name mutable or else provide a way to
> construct a function with a provided name. Since they use language
> translation, they would like the debugger and other tools to reflect
> the original declared names such as "[MyClassName
> methodWithParam:andStuff:]", in other words Objective-C looking
> methods. I don't know if language translation is the world's
> greatest thing but it seemed like a valid use case to me when they
> suggested it.
In their code generation scheme, do they ever require the generated
function to have a particular non-global scope, or will global scope do?
If global only, then the Function constructor could make an instance
with mutable name, maybe. Not easy to spec given that in every other
respect the object returned by new Function is a function object, if
we want the spec to keep name immutable for declared and expressed
functions with names.
If local or global, we could make anonymous function expressions have
no name property at all. I'm warming up to this. We could do likewise
for the result of Function as well. Only declared functions and named
function expressions would have an intrinsic name property.
More information about the Es-discuss