Skip to content
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: Fix order of rounding* option reads and resolvedOptions() #811

Merged
merged 2 commits into from
Oct 3, 2023

Conversation

FrankYFTang
Copy link
Contributor

@FrankYFTang FrankYFTang commented Jul 26, 2023

Fixing issues created by #768 and additional issues about 'order' related to number format v3 and option read/ resolvedOptoins()

  1. Move the reading of "roundingPriority" from before reading "roundingIncrement" to after reading "roundingMode" so these three fields are read in alphabetic order. https://tc39.es/ecma402/#sec-setnfdigitoptions

  2. Move the output order of "roundingIncrement" from after output "roundingMode" to before that so these two fields are read in alphabetic order in the resolvedOptions of both Intl.NumberFormat and Intl.PluralRules. https://tc39.es/ecma402/#sec-intl.numberformat.prototype.resolvedoptions https://tc39.es/ecma402/#sec-intl.pluralrules.prototype.resolvedoptions

  3. Move the output of "roundingPriority" from after "trailingZeroDisplay" before that to sync w/ Intl.NumberFormat after PR768. https://tc39.es/ecma402/#sec-intl.pluralrules.prototype.resolvedoptions

  4. Move the output of "pluralCategories" from after "trailingZeroDisplay" to before "roundingIncrement" so these options will be in alphabetic order. https://tc39.es/ecma402/#sec-intl.pluralrules.prototype.resolvedoptions

@FrankYFTang
Copy link
Contributor Author

The fix for the lint error is in #812

Copy link
Member

@ryzokuken ryzokuken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The editorial changes are the most important, thanks for the bugfixes. I don't feel strongly about the normative change, if you and other implementers all prefer alphabetical order, then let's do it.

@sffc
Copy link
Contributor

sffc commented Aug 3, 2023

TG2 Discussion: https://github.com/tc39/ecma402/blob/master/meetings/notes-2023-08-03.md#normative-fix-order-of-rounding-option-reads-and-resolvedoptions-811

Conclusion: RGN and FYT will work together on changes to the PR, which we will then bring to plenary.

@sffc
Copy link
Contributor

sffc commented Aug 23, 2023

Ping @FrankYFTang @gibson042

1 similar comment
@sffc
Copy link
Contributor

sffc commented Aug 23, 2023

Ping @FrankYFTang @gibson042

FrankYFTang added a commit to FrankYFTang/ecma402 that referenced this pull request Aug 24, 2023
Split the editorial fix from tc39#811

1. Add text to explain ComputedRoundingPriority in section "15.4 Properties of Intl.NumberFormat Instances"
https://tc39.es/ecma402/#sec-properties-of-intl-numberformat-instances and
"16.4 Properties of Intl.PluralRules Instances
https://tc39.es/ecma402/#sec-properties-of-intl-pluralrules-instances

2. Add ComputedRoundingPriority to Intl.PluralRules https://tc39.es/ecma402/#sec-intl.pluralrules
Without this, the spec is not implementable because InitializePluralRules call "SetNumberFormatDigitOptions(pluralRules, options, +0𝔽, 3𝔽, "standard")." and SetNumberFormatDigitOptions assume the intlObj has [[ComputedRoundingPriority]]
@FrankYFTang
Copy link
Contributor Author

During the discussion of https://github.com/tc39/ecma402/blob/master/meetings/notes-2023-08-03.md#normative-fix-order-of-rounding-option-reads-and-resolvedoptions-811 RGN express the desire to split out the "editorial" part of the PR to another one.

I split the item 1. and 2. into #829 now. Once we merge 829, I will rebase this PR on top of that and those editoral change should be removed from this PR.

This PR are mostly Normative but have some editorial parts

1. Editorial: Add text to explain ComputedRoundingPriority in section
"15.4 Properties of Intl.NumberFormat Instances"
https://tc39.es/ecma402/#sec-properties-of-intl-numberformat-instances
and
"16.4 Properties of Intl.PluralRules Instances
https://tc39.es/ecma402/#sec-properties-of-intl-pluralrules-instances

2. Editorial: Add ComputedRoundingPriority to Intl.PluralRules
https://tc39.es/ecma402/#sec-intl.pluralrules
Without this, the spec is not implementable because InitializePluralRules
call "SetNumberFormatDigitOptions(pluralRules, options, +0𝔽, 3𝔽, "standard")."
and SetNumberFormatDigitOptions assume the intlObj has `[[ComputedRoundingPriority]]`

3. Normative: Move the reading of "roundingPriority" from before reading
   "roundingIncrement" to after reading "roundingMode" so these three
   fields are read in alphabetic order.
https://tc39.es/ecma402/#sec-setnfdigitoptions

4. Normative: Move the output order of "roundingIncrement" from after
   output "roundingMode" to before that so these two
   fields are read in alphabetic order in the resolvedOptions of both
   Intl.NumberFormat and Intl.PluralRules.
   https://tc39.es/ecma402/#sec-intl.numberformat.prototype.resolvedoptions
   https://tc39.es/ecma402/#sec-intl.pluralrules.prototype.resolvedoptions

5. Normative: Move the output of "roundingPriority" from after
   "trailingZeroDisplay" before that to sync w/ Intl.NumberFormat after
   PR768.
   https://tc39.es/ecma402/#sec-intl.pluralrules.prototype.resolvedoptions

6. Normative: Move the output of "pluralCategories" from after
   "trailingZeroDisplay" to before "roundingIncrement" so these options
   will be in alphabetic order.
   https://tc39.es/ecma402/#sec-intl.pluralrules.prototype.resolvedoptions
Copy link
Contributor

@gibson042 gibson042 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good modulo the algorithmic details; is there already a test262 PR?

spec/pluralrules.html Outdated Show resolved Hide resolved
@FrankYFTang
Copy link
Contributor Author

PTAL

@FrankYFTang
Copy link
Contributor Author

@FrankYFTang
Copy link
Contributor Author

This looks good modulo the algorithmic details; is there already a test262 PR?

tc39/test262#3911

@FrankYFTang
Copy link
Contributor Author

FrankYFTang commented Sep 26, 2023

This PR reach consensus on 2023-09-26 meeting

@FrankYFTang
Copy link
Contributor Author

please merge

@FrankYFTang
Copy link
Contributor Author

@ben-allen @gibson042 Please merge. This has TC39 blessing last week.

@gibson042 gibson042 merged commit 5a43090 into tc39:master Oct 3, 2023
2 checks passed
@FrankYFTang FrankYFTang deleted the ReorderRounding branch October 3, 2023 21:53
jamestiotio pushed a commit to jamestiotio/v8 that referenced this pull request Oct 10, 2023
Fix order of rounding* option reads and resolvedOptions() of NumberFormat and PluralRules

tc39/ecma402#811

Details:

Change order of rounding* option reads and resolvedOptions()
1. Move the reading of "roundingPriority" from before reading "roundingIncrement" to after reading "roundingMode" so these three fields are read in alphabetic order. https://tc39.es/ecma402/#sec-setnfdigitoptions

2. Move the output order of "roundingIncrement" from after output "roundingMode" to before that so these two fields are read in alphabetic order in the resolvedOptions of both Intl.NumberFormat and Intl.PluralRules. https://tc39.es/ecma402/#sec-intl.numberformat.prototype.resolvedoptions https://tc39.es/ecma402/#sec-intl.pluralrules.prototype.resolvedoptions

3. Move the output of "roundingPriority" from after "trailingZeroDisplay" before that to sync w/ Intl.NumberFormat after PR768. https://tc39.es/ecma402/#sec-intl.pluralrules.prototype.resolvedoptions

4. Move the output of "pluralCategories" from after "trailingZeroDisplay" to before "roundingIncrement" so these options will be in alphabetic order. https://tc39.es/ecma402/#sec-intl.pluralrules.prototype.resolvedoptions


Bug: v8:14308
Change-Id: I37168bf0a6e03c0459c723c98feb8b34d95413fa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4855044
Reviewed-by: Shu-yu Guo <[email protected]>
Commit-Queue: Frank Tang <[email protected]>
Cr-Commit-Position: refs/heads/main@{#90319}
ben-allen pushed a commit to ben-allen/ecma402 that referenced this pull request Oct 12, 2023
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Mar 12, 2024
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this pull request Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants