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

resolvedOptions order #163

Closed
Josh-Cena opened this issue Aug 16, 2023 · 6 comments · Fixed by #165 or #172
Closed

resolvedOptions order #163

Josh-Cena opened this issue Aug 16, 2023 · 6 comments · Fixed by #165 or #172
Labels
consensus We reached a consensus in a discussion meeting, through email or the issue discussion

Comments

@Josh-Cena
Copy link

This is a rehash of #30.

The ordering was fixed in 02584a5, but then reordered again in #150.

I wonder if the decision was intentional, since it makes locale come out second. This is observable at runtime.

JSC currently still puts numberingSystem last and locale first.

@anba
Copy link
Contributor

anba commented Aug 17, 2023

[[Locale]] and [[NumberingSystem]] should be switched, so that the order is

  1. [[Locale]]
  2. [[NumberingSystem]]
  3. [[Style]]
  4. [[YearsStyle]], [[YearsDisplay]], etc.
  5. And [[FractionalDigits]] as the last entry.

@ben-allen
Copy link
Collaborator

Does Anba's ordering result in a normative change from the spec pre-#150?

@Josh-Cena
Copy link
Author

Normative-wise, yes, because [[NumberingSystem]] is now second instead of last.

@FrankYFTang
Copy link
Collaborator

The spec which passed Stage 3 is in the following order

locale
style
years
yearsDisplay
months
monthsDisplay
weeks
weeksDisplay
days
daysDisplay
hours
hoursDisplay
minutes
minutesDisplay
seconds
secondsDisplay
milliseconds
millisecondsDisplay
microseconds
microsecondsDisplay
nanoseconds
nanosecondsDisplay
fractionalDigits
numberingSystem

the order got changed accidentially while merging PR 150 then I just merged PR 165 to correct that accidental change.

So I reopen this issue if we want to chagne the order. That need to be discuss and reach consensus in TC39 with a Normative PR

@FrankYFTang
Copy link
Collaborator

FrankYFTang commented Aug 28, 2023

@anba, could you explain why you say

[[Locale]]
[[NumberingSystem]]
[[Style]]
[[YearsStyle]], [[YearsDisplay]], etc.
And [[FractionalDigits]] as the last entry.

I am not agree (nor disagree) with you. Just want to make sure we all understand the reasoning of that.

Is that because that align with the access order of the information from the option bag?

@anba
Copy link
Contributor

anba commented Aug 29, 2023

[[NumberingSystem]] should appear right after [[Locale]] to match other Intl constructors, which generally have properties from Unicode extension keys right after [[Locale]] [1, 2]:

For example:

Is that because that align with the access order of the information from the option bag?

Yes, I think so. Intl.NumberFormat doesn't match this anymore, but I think the other constructors still align the resolvedOptions object with the access order in the constructor function. (Maybe except hour12, which got reordered later when support for hourCycle was added.)


[1] Intl.Collator is an exception, because its Unicode extension properties numeric and caseFirst are optional, because support for kn and kf is optional.

[2] Intl.RelativeTimeFormat does not have [[NumberingSystem]] right after [[Locale]]. We probably overlooked this when adding it in tc39/proposal-intl-relative-time#100. We may want to consider reordering the output of Intl.RelativeTimeFormat.prototype.resolvedOptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consensus We reached a consensus in a discussion meeting, through email or the issue discussion
Projects
None yet
5 participants