-
Notifications
You must be signed in to change notification settings - Fork 10
fixes #28: allow anonymous well-known intrinsic objects #31
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like an ambiguity; I would expect that an anonymous function with a name of the empty string (whether in owned property or not) would appear as an anonymous function.
Is there a better way to phrase this that doesn’t hinge on IdentifierName?
@ljharb Since |
https://tc39.github.io/ecma262/#sec-ecmascript-standard-built-in-objects uses "is not identified as an anonymous function", so Also revert 994e506 to make %ThrowTypeError% anonymous again?
Based on https://tc39.github.io/ecma262/#sec-ecmascript-standard-built-in-objects and https://tc39.github.io/ecma262/#sec-function-instances-name, I'd say a function is anonymous if and only if the function does not have an own |
Why? |
It's really nice for debugging to have everything named; what's the benefit to making it anonymous? |
Because we have multiple anonymous built-in functions and only giving %ThrowTypeError% a name because it is also a well-known object seems questionable. (This is with my spec hat on, for example when only considering the implementation in SpiderMonkey, I'd say remove all the anonymous built-in functions.) |
I'd prefer any built-in function that's available at realm creation time be named; are there others besides ThrowTypeError? |
It's more likely a user gets a reference to, let's say a Proxy revocation function, than a reference to %ThrowTypeError%. So when we speak about the debugging experience, adding a name to Proxy revocation functions seems more useful than adding a name to %ThrowTypeError%, right? |
@anba Regardless, it is better to have it be named than not named. edit: Though now that it's not strictly necessary as part of this proposal, I will remove it. But I still think we should name them when it would be helpful to do so. |
In that case adding the name should happen through a normal PR to https://github.com/tc39/ecma262 instead of this proposal. :-) |
Fixes #28. I'm assuming here that "named" is the opposite of "anonymous" currently used in the spec. If we think that's unclear, I can change it to "non-anonymous", but that sounds like a double negative to me.
/cc @anba for review