ecma402 icon indicating copy to clipboard operation
ecma402 copied to clipboard

Editorial: Start all fields and slots with an uppercase code point

Open caridy opened this issue 9 years ago • 11 comments
trafficstars

In order to align with 262 on this, we will have to refactor part of the spec due to the following:

As an extension to the Record Specification Type, the notation "[[<name>]]" denotes a field whose name is given by the variable name, which must have a String value. For example, if a variable s has the value "a", then [[<s>]] denotes the field [[<a>]].

For ECMAScript objects, this standard may use variable-named internal slots: The notation "[[<name>]]" denotes an internal slot whose name is given by the variable name, which must have a String value. For example, if a variable s has the value "a", then [[<s>]] denotes the [[<a>]] internal slot.

This is very tricky, but worth the effort IMO. I might delay this work until after 3rd edition because formatToParts will change the way we transform the patterns for number and datetime format, which can facilitate this work.

/cc @littledan @bterlson

caridy avatar Feb 27 '16 18:02 caridy

If it's a 'procedurally generated' name, then I don't think this rule needs to apply the same way. However, I like the way that formatToParts changes this.

littledan avatar Mar 09 '16 00:03 littledan

yeah, I do have a local branch for this, but lets wait until after formatToParts() lands for 4th edition.

caridy avatar Mar 09 '16 14:03 caridy

hopefully 5th edition.

caridy avatar Aug 10 '17 16:08 caridy

These is related to #56 as well. We are almost there, and lowercase is only used in match resolvers and locale data records as far as I can tell. @anba, @littledan, do you guys think that this is realistic?

caridy avatar Dec 22 '17 17:12 caridy

Not sure what you are asking. The change still seems like a good idea to me.

littledan avatar Dec 23 '17 00:12 littledan

@leobalter @littledan I also wonder if we should keep with issue open. Now that I submitted https://github.com/tc39/ecma402/pull/401, all the remaining non-capitalized record fields are from constructing records from locale data (for example, in resolveLocale). Maybe it's best to simply allow non-capitalized field names in 402 because of this case.

spectranaut avatar Jan 11 '20 00:01 spectranaut

@spectranaut I'm glad your patch landed. I agree it wouldn't make sense to capitalize a record field like [[nu]]. However, I don't understand why things like [[locale]], [[dataLocale]] and [[extension]] should be lower case. Was this left that way deliberately?

littledan avatar May 02 '20 13:05 littledan

Related: #339

sffc avatar Jun 05 '20 21:06 sffc

@gibson042 this still needs to happen, right?

ryzokuken avatar Jan 20 '23 16:01 ryzokuken

I don't feel strongly about it. The lowercase field names don't bother me, especially those that directly correspond with the canonical form of BCP 47 language subtags or Unicode -u- extension keys in e.g. [[AvailableLocales]] and [[RelevantExtensionKeys]]. But I would like to uppercase [[locale]] and [[extension]] field names in locale records (probably renaming at least [[locale]] in the process), [[localeMatcher]]/[[dataLocale]]/etc. in ResolveLocale, and anything else that is not reflecting externally-defined names.

gibson042 avatar Jan 20 '23 22:01 gibson042

Happy to let the editors decide whether to either fix this issue or close this issue.

sffc avatar Jan 21 '23 02:01 sffc