-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reconsidering Reflect[Symbol.toStringTag] #1970
Comments
I see that |
I am more inclined towards
due to simplicity arguments in #495 (comment). Inheriting from
|
cc @syg re Atomics question |
Note that Firefox will soon have Atomics as well (though initially without means to make |
I think having On the other hand it seems like in DOM/HTML land "namespace" objects like |
If we decide to go with "maximal toStringTagging for debuggability", then should |
I'm +1 on adding toStringTag to new namespaces going forward. |
Would someone be willing to drive this to consensus within TC39? (I think I can speak for web specs and say that we'll be fine to follow any precedent.) |
I’ll prepare a needs consensus PR and add it to the next meeting’s agenda. |
Thanks @ljharb! Perhaps you, or one of the 402 editors, could do the same for |
Already happened in tc39/ecma402#430 |
Hmm, I don't see anything for |
Oh, right. Looks like that one should be added, too. |
@domenic Consensus from TC39 is that we are in favor of namespace objects having |
#495 indicates that it is intentional to not give
Reflect
aSymbol.toStringTag
value, making it intentionally inconsistent with the older namespacesMath
andJSON
. The implication was then that all future namespace objects should not have such toStringTags.However, since that time
Atomics
was added, and given a toStringTag. At this point it seems likeReflect
is the odd one out.It'd be good to get a conclusion here especially to inform the web platform. Currently the specification for web platform namespaces does not indicate they should have any toStringTag. But, browsers are inconsistent: of the three namespaces
WebAssembly
,console
, andCSS
, there seems to be some agreement thatWebAssembly
gets a toStringTag, but the others do not. We're trying to straighten this out, but can't figure out which direction to go in, because the ES spec itself is inconsistent.My recommendation is that everything gain a
Symbol.toStringTag
, includingReflect
, and that we align the web platform namespaces in the same way. I.e. favor consistency over the simplicity arguments from #495. However, I'm fine with the opposite conclusion, whereMath
,JSON
, andAtomics
become legacy exceptions; we should just state it clearly (perhaps with non-normative notes in the toStringTag subsections for each of these objects).The text was updated successfully, but these errors were encountered: