Open
Description
This has come up a few times during proposal-symbols-as-weakmap-keys. Creating an issue here as the 402 repo feels like a more central point to discuss this.
Related discussions in original PR: #84
Test262 issue: tc39/test262#3420
The Intl spec says that %Intl%.[[FallbackSymbol]]
is created in the current realm. Implying that each realm has it's own unique IntlLegacyConstructedSymbol.
Line 16 in fe78d96
This can be observed:
let getFallbackSymbol_code = `Reflect.ownKeys(
Intl.DateTimeFormat.call(Object.create(Intl.DateTimeFormat.prototype))
).filter(v => typeof v === 'symbol' && v.description === 'IntlLegacyConstructedSymbol')[0];`;
// using ShadowRealms:
(new ShadowRealm).evaluate(getFallbackSymbol_code) !== (new ShadowRealm).evaluate(getFallbackSymbol_code)
// Or iframes:
const frame = document.createElement('iframe');
document.body.appendChild(frame);
eval(getFallbackSymbol_code) !== frame.contentWindow.eval(getFallbackSymbol_code);
However implementations differ.
It is unclear if this is an issue in practice. The symbol is there to ensure backwards compatibility with existing code, rather than for new code to use. However having a concrete issue to capture/track the subtle inconsistency feels appropriate.
cc: @ljharb
Activity