Closed rricard closed 2 years ago
Reporting @ljharb (co-champion) opinion on this from https://github.com/rricard/proposal-symbol-predicates/pull/2#discussion_r917281399:
I believe the overwhelming preference is for FallbackSymbol to not be well-known, as the spec currently requires, and for v8 to fix it to not be cross-realm.
If it becomes well-known, 402 would need to add it to the table.
I agree that this should be settled out of this proposal, either by inclusion in the table or by keeping it as a unique symbol. This will probably need to be settled before we go to Stage 3 in order to avoid future behaviour change from the predicate once landed.
Per the decision today in plenary: the current spec will be kept for a per-realm FallbackSymbol, so not a Well-known symbol. The current spec text for this proposal is therefore still correct.
The current definitions of well-known-ness for both intrinsic objects and intrinsic symbols only seem to concern the status of the intrinsic having a name defined in the spec for referencing it. It doesn’t seem to have anything to do with whether the intrinsic being named describes a “pan-realm instance” or a “set of per-realm instances” — it just happens to be the case that all well-known symbols fall in the former group presently. In other words, nothing in the spec seems to have forbidden ECMA-402 from making %Intl%.[[FallbackSymbol]]% “@@fallback” with the per-realm semantics. In fact...
Unless otherwise specified, well-known symbols values are shared by all realms [...]
...appears to make it explicit that they could have.
Perhaps another name should be chosen (e.g. isUniversal
) rather than one that exposes previously spec-internal terminology to authors. However if isWellKnown
is preferred (or even if it isn’t, I think?), it would be good for the current definition of well-known symbols to be updated at the same time so that the informal conflation of well-known & pan-realm can be a formal truth going forward.
What forbids them is that non-registry Symbols do not have cross-realm semantics, so it is a violation for any of them TO have it - except the ones that 262 anoints, which are the well-known ones.
I agree that the concept of a spec-annointed pan-realm symbol exists. I don’t agree that the term “well-known symbol” is currently defined in a way that makes it synonymous with that concept. But I do agree that it ought to be defined that way!
I don't think it is synonymous inherently; but non-registry cross-realm symbols are forbidden, except where 262 allows them; and 262 only allows them for well-known symbols (which are symbols listed in the table). I agree the definitions could be rewritten to make that reality less circuitous, but I disagree that it's currently defined incorrectly.
This was a quote from the ECMA-262 definition:
Unless otherwise specified, well-known symbols values are shared by all realms [...]
That pretty explicitly says that a well-known symbol could be introduced that isn’t cross-realm. Given the current definition only concerns the status of an intrinsic symbol as having a name in a particular table, this doesn’t seem super weird to me — I don’t follow what’s indirectly forbidding it. In any case:
Either way, I believe “unless otherwise specified” should be removed as part of this proposal’s spec update (or beforehand).
Yes, it could be - and Intl didn't introduce one because they didn't add it to the table. Had they, it would have been both properly cross-realm and well-known.
There's nothing forbidding other specs from adding to the table - only from having a cross-realm symbol that isn't in the table.
Had they, it would have been both properly cross-realm and well-known.
I’m afraid I still don’t follow. The definition says members of the table are cross-realm unless otherwise specified. What would have stopped them from specifying otherwise?
There's nothing forbidding other specs from adding to the table - only from having a cross-realm symbol that isn't in the table.
Right. Adding cross-realm symbols that aren’t in the table isn’t the issue I’m describing. I’m talking about adding non-cross-realm symbols to the table, which the spec’s definition expressly states is possible and (afaict) there doesn’t seem to be anything indirectly forbidding it somewhere else.
To be clear, I’m making a case that the definition should be updated to provide the guarantee that all table members are cross-realm; I’m not disagreeing with the premise of isWellKnown or its intended semantics.
The definition already provides the guarantee; it sounds like you want the guarantee that things not in the table are not cross-realm, which I'm claiming is already the case, despite "otherwise specified".
it sounds like you want the guarantee that things not in the table are not cross-realm
No. I understand that that’s covered elsewhere.
The definition already provides the guarantee [that the table only includes cross-realm symbols]
I’m not sure how I can communicate more clearly that the definition explicitly states that this is not guaranteed. As that allowance has never been taken advantage of in practice, it can be removed, but right now it’s there.
(Thanks for bearing with me — I’m confident we’ll end up on the same page sooner or later 😄.)
While I don't agree that's what it says, even if you're right, that's fine, because it's not being taken advantage of. To make that change is something that'd be up to the editors and would be entirely unrelated to any proposal.
I’m interested in understanding alternative interpretations of the quoted text (“shared by all realms unless otherwise specified”) that allow it to constitute or be compatible with a guarantee that well-known symbols are shared by all realms.
That said, I also won’t bug you about it further :)
If you’re curious: I’ve included notes below on what I suspect explains why the text in question is there and what it originally intended to allow for, archaeologically & speculatively pieced together by digging through old ES spec texts/discussions/ephemera. Don’t know how accurate the analysis is, but perhaps it will be entertaining...
As discussed in https://github.com/rricard/proposal-symbol-predicates/pull/2#discussion_r917245590 - We need to know if %Intl%.[[FallbackSymbol]] is going to be considered by this predicate as a Well-known symbol or not.