-
Notifications
You must be signed in to change notification settings - Fork 106
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
Normative: Stage4 PR for proposal-intl-enumeration #716
Conversation
Plan to suggest moving to Stage 4 in Nov 2022 https://github.com/tc39/proposal-intl-enumeration It is already implemented in Chrome m99, Safari 15.4 and Firefox 93. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf#browser_compatibility
1. Else if _key_ is *"unit"*, then | ||
1. Let _list_ be AvailableCanonicalUnits( ). | ||
1. Else, | ||
1. Throw a *RangeError* exception. |
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.
a RangeError, from an unknown key? i'd expect a TypeError here.
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.
Why is that? the type of the key is String, we also throw RangeError in https://tc39.es/ecma402/#sec-getoption right?
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.
other places in ECMA402 we also throw RangeError
https://tc39.es/ecma402/#sec-canonicalcodefordisplaynames
https://tc39.es/ecma402/#sec-canonicalizelocalelist
"a. If collation does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception."
in https://tc39.es/ecma402/#sec-initializecollator
"a. If calendar does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception.
a. If numberingSystem does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception.
b. If the result of ! IsValidTimeZoneName(timeZone) is false, then
"
in https://tc39.es/ecma402/#sec-initializedatetimeformat
"a. If calendar does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception.
a. If collation does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception.
a. If numberingSystem does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception.
"
in https://tc39.es/ecma402/#sec-Intl.Locale
also
https://tc39.es/ecma402/#sec-apply-options-to-tag
https://tc39.es/ecma402/#sec-initializenumberformat
"
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.
That seems very strange - RangeErrors are for when something is out of a range - enums aren't a "range", conceptually or otherwise.
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.
RangeError (emphasis mine)
Indicates a value that is not in the set or range of allowable values.
It's also used this way in ECMA-262:
- NumberToBigInt
- String.fromCodePoint
- String.prototype.normalize (an especially good analog)
- InitializeTypedArrayFromArrayBuffer
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.
fromCodePoint is an actual ascii range; the AOs are ranges as well; but you’re right that normalize is a good analog. It still seems super weird to me, since an enum simply isn’t a range of any kind.
Ping to the editors to review this PR. |
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.
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
PTAL and merge if ready? |
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.
A couple more phrase replacements.
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
PTAL and merge |
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 still looks good to me, modulo the linting fix. @ryzokuken, could you look it over as well?
|
||
<emu-clause id="sec-availablecanonicaltimezones" type="implementation-defined abstract operation"> | ||
<h1> | ||
AvailableCanonicalTimeZones ( |
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.
AvailableCanonicalTimeZones ( | |
AvailableCanonicalTimeZoneIdentifiers ( |
With Temporal approaching Stage 4, "TimeZone" will soon be ambiguous: does it mean string identifier or a Temporal.TimeZone
object?
Therefore @gibson042 and I are planning to rename all identifier-related AOs with an "Identifier" suffix. Given that this is a new AO, should we rename it here too to save churn later?
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.
how about do those after merge this PR. Temporal is not going to be ES2023 but this will be
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.
OK, that's fine with me. Not a big deal either way.
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
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.
LGTM overall, I am happy with throwing a RangeError
here, since it describes the exact nature of the failure better than a TypeError
would, as the latter may result in user confusion.
* Normative: Stage4 PR for proposal-intl-enumeration Plan to suggest moving to Stage 4 in Nov 2022 https://github.com/tc39/proposal-intl-enumeration It is already implemented in Chrome m99, Safari 15.4 and Firefox 93. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf#browser_compatibility * sync w/ intl-enumeration pull/43 tc39/proposal-intl-enumeration#43 * Update spec/locales-currencies-tz.html Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update spec/locales-currencies-tz.html Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update spec/locales-currencies-tz.html Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update spec/locales-currencies-tz.html Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update spec/locales-currencies-tz.html Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update spec/locales-currencies-tz.html Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update spec/locales-currencies-tz.html Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update spec/locales-currencies-tz.html Co-authored-by: Richard Gibson <richard.gibson@gmail.com> --------- Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
* Normative: Stage4 PR for proposal-intl-enumeration Plan to suggest moving to Stage 4 in Nov 2022 https://github.com/tc39/proposal-intl-enumeration It is already implemented in Chrome m99, Safari 15.4 and Firefox 93. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf#browser_compatibility * sync w/ intl-enumeration pull/43 tc39/proposal-intl-enumeration#43 * Update spec/locales-currencies-tz.html Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update spec/locales-currencies-tz.html Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update spec/locales-currencies-tz.html Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update spec/locales-currencies-tz.html Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update spec/locales-currencies-tz.html Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update spec/locales-currencies-tz.html Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update spec/locales-currencies-tz.html Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update spec/locales-currencies-tz.html Co-authored-by: Richard Gibson <richard.gibson@gmail.com> --------- Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
Plan to suggest moving to Stage 4 in Nov 2022
https://github.com/tc39/proposal-intl-enumeration
It is already implemented in Chrome m99, Safari 15.4 and Firefox 93.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf#browser_compatibility