Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

fixes #28: allow anonymous well-known intrinsic objects #31

Merged
merged 1 commit into from
Mar 6, 2018

Conversation

michaelficarra
Copy link
Member

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

Copy link
Member

@ljharb ljharb left a 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?

@michaelficarra
Copy link
Member Author

@ljharb Since IdentifierName is optional, I think that works out just fine.

@anba
Copy link

anba commented Mar 5, 2018

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.

https://tc39.github.io/ecma262/#sec-ecmascript-standard-built-in-objects uses "is not identified as an anonymous function", so "Additionally, if _func_ is a <emu-xref href="#sec-well-known-intrinsic-objects">Well-known Intrinsic Object</emu-xref> and is not identified as an anonymous function, [...]" should work out.

Also revert 994e506 to make %ThrowTypeError% anonymous again?

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.

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 name property.

@michaelficarra
Copy link
Member Author

Also revert 994e506 to make %ThrowTypeError% anonymous again?

Why?

@ljharb
Copy link
Member

ljharb commented Mar 5, 2018

It's really nice for debugging to have everything named; what's the benefit to making it anonymous?

@anba
Copy link

anba commented Mar 5, 2018

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.)

@ljharb
Copy link
Member

ljharb commented Mar 5, 2018

I'd prefer any built-in function that's available at realm creation time be named; are there others besides ThrowTypeError?

@anba
Copy link

anba commented Mar 5, 2018

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?

@michaelficarra
Copy link
Member Author

michaelficarra commented Mar 6, 2018

@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.

@anba
Copy link

anba commented Mar 6, 2018

Regardless, it is better to have it be named than not named.

In that case adding the name should happen through a normal PR to https://github.com/tc39/ecma262 instead of this proposal. :-)

@michaelficarra michaelficarra merged commit 870cd47 into master Mar 6, 2018
@michaelficarra michaelficarra deleted the GH-28 branch March 6, 2018 15:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants