ecma402 icon indicating copy to clipboard operation
ecma402 copied to clipboard

Consistency for [[HourCycle]] from LocaleData

Open leobalter opened this issue 6 years ago • 6 comments
trafficstars

From https://tc39.github.io/ecma402/#sec-initializedatetimeformat

Is that lowercase dataLocalData.[[hourCycle]] intentional? It happens twice in the specs.

It sounds like a typo but I might be missing something from the LocaleData as in Let dataLocaleData be localeData.[[<dataLocale>]].

But also from DateTimeFormat Internal Slots we read [[LocaleData]][locale] must have a hourCycle field with a String value equal to "h11", "h12", "h23", or "h24" for all locale values.

First fix I can imagine is [[hourCycle]] becoming [[HourCycle]] with the Internal Slots section describing the hourCycle as a matching internal field.

leobalter avatar Apr 09 '19 15:04 leobalter

I'm not sure if there's a problem here. Lowercase is used for record fields of the locale data, and uppercase is used for the internal slots of the formatter. If we switch to uppercase for the locale data, we might want to do that in a more broad way.

littledan avatar Apr 10 '19 09:04 littledan

I guessed something like it but it feels odd accessing the record field of the locale data as if it were a internal slots, including the [[]] parts.

Maybe the consistency I desire should also consider the HourCycle is also declared with the brackets padding, e.g. here should probably say [[HourCycle]].

leobalter avatar Apr 10 '19 15:04 leobalter

Maybe the alternative is adding some spec text saying the record fields of localeData are accessed like internal slots and might be represented as such with the brackets padding. Like in Intl.Collator's accessing sensitivity. This would be just a clarification without a change to any other part of the specs.

WDYT, @littledan?

leobalter avatar Apr 10 '19 15:04 leobalter

The locale data used to be objects, and @anba refactored it to be records. Clarifying how this works sounds like a really good idea--I had trouble understanding it for a while when I was getting into these specs, personally. I don't have a great idea for how to explain things better, though.

littledan avatar Apr 11 '19 06:04 littledan

cool, this also sounds like a good editorial exercise thing. I'll check with @spectranaut for some good insights for it.

leobalter avatar Apr 11 '19 15:04 leobalter

If this needs to be discussed further on Friday, please move the corresponding Kanban card to the Discuss column.

sffc avatar Apr 18 '19 03:04 sffc