-
Notifications
You must be signed in to change notification settings - Fork 107
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
Editorial: Modernise spec to use structured headers and correct number representations #822
Conversation
Not a review, but I just wanted to say a heartfelt thank you for doing this ❤️ |
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.
Looks great overall, thanks a lot for this! I made a few comments but nothing too serious.
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.
One incredibly small nit -- there's a missing word ("according pattern" instead of "according to pattern") in FormatDateTimePattern
@gibson042 Any objections to merging this one? |
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 is magnificent! I have a number of suggestions, almost all of which cluster into integer vs. integral Number and how to reference tabular data.
@gibson042 Do you think this one is mergeable as stands? |
Yes, but there would be substantial followup churn. |
Add new `GetLocale{Language,Script,Region,Variants}` operations to retrieve the corresponding subtags from a locale tag. These new operations are used in `ApplyOptionsToTag`, `IsStructurallyValidLanguageTag`, and the `Intl.Locale.prototype` accessor functions. GetLocaleLanguage: Returns the longest prefix matching `unicode_language_subtag`. The previous definitions could be misinterpreted to match variant subtags whose length is larger than the language subtag. For example in "en-basiceng"` the longest substring matching `unicode_language_subtag` is "basiceng". GetLocaleScript: The previous definition from `Intl.Locale.prototype.script` is reused. GetLocaleRegion: Instead of using the previous definition from `Intl.Locale.prototype.region`, it was rewritten to match definition from `GetLocaleScript` a bit more closely. To not confuse language and region subtags, the leading language subtag is first removed before searching for `unicode_region_subtag`. GetLocaleVariants: Uses the suggestion from code review in tc39#822. The leading "-" character is removed for consistency with the other three new operations. `get Intl.prototype.{language,script,region}` are now all simply calling the new abstract operations to retrieve the subtags. `ApplyOptionsToTag` uses the new operations to retrieve the subtags from the original language tag when the corresponding option is absent. The updated `languageId` is now manually constructed through string concatenation instead of using subtag matching. `IsStructurallyValidLanguageTag` now calls `GetLocaleVariants` to retrieve the variant subtags. The variable `lang` was renamed to `languageId` for consistency with the rest of the spec and because `lang` can be more easily misinterpreted to stand for "language". `CanonicalizeUnicodeLocaleId` was changed to fix the incorrect redeclaration warning for `extension` from ecmarkup: - Instead of using yet another way to retrieve the Unicode extension sequence, simply use the existing terms "Unicode locale extension sequence". (The existing term already makes sure that substrings in private-use subtags are ignored, so we don't have to worry about `pu_extensions`. - "Unicode locale extension sequences" include the leading "-" character, so `newExtension` actually needs to be initialised with "-u".
Fixed all review suggestions (except the suggestion to use Number values in internal slots). I've also updated
(Note: Updating ecmarkup also leads to using the new font.) |
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 few more suggestions, but this looks good to me. Thanks @anba!
Add new `GetLocale{Language,Script,Region,Variants}` operations to retrieve the corresponding subtags from a locale tag. These new operations are used in `ApplyOptionsToTag`, `IsStructurallyValidLanguageTag`, and the `Intl.Locale.prototype` accessor functions. GetLocaleLanguage: Returns the longest prefix matching `unicode_language_subtag`. The previous definitions could be misinterpreted to match variant subtags whose length is larger than the language subtag. For example in "en-basiceng"` the longest substring matching `unicode_language_subtag` is "basiceng". GetLocaleScript: The previous definition from `Intl.Locale.prototype.script` is reused. GetLocaleRegion: Instead of using the previous definition from `Intl.Locale.prototype.region`, it was rewritten to match definition from `GetLocaleScript` a bit more closely. To not confuse language and region subtags, the leading language subtag is first removed before searching for `unicode_region_subtag`. GetLocaleVariants: Uses the suggestion from code review in tc39#822. The leading "-" character is removed for consistency with the other three new operations. `get Intl.prototype.{language,script,region}` are now all simply calling the new abstract operations to retrieve the subtags. `ApplyOptionsToTag` uses the new operations to retrieve the subtags from the original language tag when the corresponding option is absent. The updated `languageId` is now manually constructed through string concatenation instead of using subtag matching. `IsStructurallyValidLanguageTag` now calls `GetLocaleVariants` to retrieve the variant subtags. The variable `lang` was renamed to `languageId` for consistency with the rest of the spec and because `lang` can be more easily misinterpreted to stand for "language". `CanonicalizeUnicodeLocaleId` was changed to fix the incorrect redeclaration warning for `extension` from ecmarkup: - Instead of using yet another way to retrieve the Unicode extension sequence, simply use the existing terms "Unicode locale extension sequence". (The existing term already makes sure that substrings in private-use subtags are ignored, so we don't have to worry about `pu_extensions`. - "Unicode locale extension sequences" include the leading "-" character, so `newExtension` actually needs to be initialised with "-u".
Thanks, all fixed now. |
Add new `GetLocale{Language,Script,Region,Variants}` operations to retrieve the corresponding subtags from a locale tag. These new operations are used in `ApplyOptionsToTag`, `IsStructurallyValidLanguageTag`, and the `Intl.Locale.prototype` accessor functions. GetLocaleLanguage: Returns the longest prefix matching `unicode_language_subtag`. The previous definitions could be misinterpreted to match variant subtags whose length is larger than the language subtag. For example in "en-basiceng"` the longest substring matching `unicode_language_subtag` is "basiceng". GetLocaleScript: The previous definition from `Intl.Locale.prototype.script` is reused. GetLocaleRegion: Instead of using the previous definition from `Intl.Locale.prototype.region`, it was rewritten to match definition from `GetLocaleScript` a bit more closely. To not confuse language and region subtags, the leading language subtag is first removed before searching for `unicode_region_subtag`. GetLocaleVariants: Uses the suggestion from code review in tc39#822. The leading "-" character is removed for consistency with the other three new operations. `get Intl.prototype.{language,script,region}` are now all simply calling the new abstract operations to retrieve the subtags. `ApplyOptionsToTag` uses the new operations to retrieve the subtags from the original language tag when the corresponding option is absent. The updated `languageId` is now manually constructed through string concatenation instead of using subtag matching. `IsStructurallyValidLanguageTag` now calls `GetLocaleVariants` to retrieve the variant subtags. The variable `lang` was renamed to `languageId` for consistency with the rest of the spec and because `lang` can be more easily misinterpreted to stand for "language". `CanonicalizeUnicodeLocaleId` was changed to fix the incorrect redeclaration warning for `extension` from ecmarkup: - Instead of using yet another way to retrieve the Unicode extension sequence, simply use the existing terms "Unicode locale extension sequence". (The existing term already makes sure that substrings in private-use subtags are ignored, so we don't have to worry about `pu_extensions`. - "Unicode locale extension sequences" include the leading "-" character, so `newExtension` actually needs to be initialised with "-u".
Add new `GetLocale{Language,Script,Region,Variants}` operations to retrieve the corresponding subtags from a locale tag. These new operations are used in `ApplyOptionsToTag`, `IsStructurallyValidLanguageTag`, and the `Intl.Locale.prototype` accessor functions. GetLocaleLanguage: Returns the longest prefix matching `unicode_language_subtag`. The previous definitions could be misinterpreted to match variant subtags whose length is larger than the language subtag. For example in "en-basiceng"` the longest substring matching `unicode_language_subtag` is "basiceng". GetLocaleScript: The previous definition from `Intl.Locale.prototype.script` is reused. GetLocaleRegion: Instead of using the previous definition from `Intl.Locale.prototype.region`, it was rewritten to match definition from `GetLocaleScript` a bit more closely. To not confuse language and region subtags, the leading language subtag is first removed before searching for `unicode_region_subtag`. GetLocaleVariants: Uses the suggestion from code review in tc39#822. The leading "-" character is removed for consistency with the other three new operations. `get Intl.prototype.{language,script,region}` are now all simply calling the new abstract operations to retrieve the subtags. `ApplyOptionsToTag` uses the new operations to retrieve the subtags from the original language tag when the corresponding option is absent. The updated `languageId` is now manually constructed through string concatenation instead of using subtag matching. `IsStructurallyValidLanguageTag` now calls `GetLocaleVariants` to retrieve the variant subtags. The variable `lang` was renamed to `languageId` for consistency with the rest of the spec and because `lang` can be more easily misinterpreted to stand for "language". `CanonicalizeUnicodeLocaleId` was changed to fix the incorrect redeclaration warning for `extension` from ecmarkup: - Instead of using yet another way to retrieve the Unicode extension sequence, simply use the existing terms "Unicode locale extension sequence". (The existing term already makes sure that substrings in private-use subtags are ignored, so we don't have to worry about `pu_extensions`. - "Unicode locale extension sequences" include the leading "-" character, so `newExtension` actually needs to be initialised with "-u".
Updated again to resolve merge conflicts with latest changes to the main branch. |
Thank you again so much for this! |
…r representations (tc39#822) Sweeping changes across the entire spec to update ECMA-402 to use structured headers as used in ECMA-262 Also contains related refactoring, plus updates to represent numbers correctly/consistently
Add new `GetLocale{Language,Script,Region,Variants}` operations to retrieve the corresponding subtags from a locale tag. These new operations are used in `ApplyOptionsToTag`, `IsStructurallyValidLanguageTag`, and the `Intl.Locale.prototype` accessor functions. GetLocaleLanguage: Returns the longest prefix matching `unicode_language_subtag`. The previous definitions could be misinterpreted to match variant subtags whose length is larger than the language subtag. For example in "en-basiceng"` the longest substring matching `unicode_language_subtag` is "basiceng". GetLocaleScript: The previous definition from `Intl.Locale.prototype.script` is reused. GetLocaleRegion: Instead of using the previous definition from `Intl.Locale.prototype.region`, it was rewritten to match definition from `GetLocaleScript` a bit more closely. To not confuse language and region subtags, the leading language subtag is first removed before searching for `unicode_region_subtag`. GetLocaleVariants: Uses the suggestion from code review in tc39#822. The leading "-" character is removed for consistency with the other three new operations. `get Intl.prototype.{language,script,region}` are now all simply calling the new abstract operations to retrieve the subtags. `ApplyOptionsToTag` uses the new operations to retrieve the subtags from the original language tag when the corresponding option is absent. The updated `languageId` is now manually constructed through string concatenation instead of using subtag matching. `IsStructurallyValidLanguageTag` now calls `GetLocaleVariants` to retrieve the variant subtags. The variable `lang` was renamed to `languageId` for consistency with the rest of the spec and because `lang` can be more easily misinterpreted to stand for "language". `CanonicalizeUnicodeLocaleId` was changed to fix the incorrect redeclaration warning for `extension` from ecmarkup: - Instead of using yet another way to retrieve the Unicode extension sequence, simply use the existing terms "Unicode locale extension sequence". (The existing term already makes sure that substrings in private-use subtags are ignored, so we don't have to worry about `pu_extensions`. - "Unicode locale extension sequences" include the leading "-" character, so `newExtension` actually needs to be initialised with "-u".
No description provided.