Skip to content

Commit

Permalink
Editorial: Incorporate ECMA-262 "lexicographic code unit order"
Browse files Browse the repository at this point in the history
No need for the extra AO SortStringListByCodeUnit. ECMA-262 editors
decided to go with the wording "sorted according to lexicographic code
unit order".

The change to AvailableNamedTimeZoneIdentifiers has now been made directly
in ECMA-262, so no need to carry that diff in the Temporal spec anymore.

See tc39/ecma262#3299.
  • Loading branch information
ptomato authored and Ms2ger committed May 2, 2024
1 parent 4e96bee commit 4e96961
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 63 deletions.
2 changes: 1 addition & 1 deletion spec/abstractops.html
Original file line number Diff line number Diff line change
Expand Up @@ -1991,7 +1991,7 @@ <h1>
1. Append _desc_.[[Property]] to _fieldNames_.
1. If _desc_.[[Required]] is *true* and _requiredFields_ is a List, then
1. Append _desc_.[[Property]] to _requiredFields_.
1. Let _sortedFieldNames_ be SortStringListByCodeUnit(_fieldNames_).
1. Let _sortedFieldNames_ be a List whose elements are the elements of _fieldNames_, sorted according to lexicographic code unit order.
1. Let _previousProperty_ be *undefined*.
1. For each property name _property_ of _sortedFieldNames_, do
1. If _property_ is one of *"constructor"* or *"__proto__"*, then
Expand Down
3 changes: 1 addition & 2 deletions spec/calendar.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,10 @@ <h1>
<dd>Each element in the returned List represents a calendar type supported by the implementation.</dd>
</dl>
<emu-alg>
1. Let _calendars_ be the List of String values representing calendar types supported by the implementation.
1. Let _calendars_ be the List of String values representing calendar types supported by the implementation, sorted according to lexicographic code unit order.
1. Assert: _calendars_ contains *"iso8601"*.
1. [declared="S"] Assert: _calendars_ does not contain any element _S_ for which the ASCII-lowercase of _S_ is not _S_.
1. Assert: _calendars_ does not contain any element that does not identify a calendar type in the <a href="https://cldr.unicode.org/">Unicode Common Locale Data Repository (CLDR)</a>.
1. Return SortStringListByCodeUnit(_calendars_).
</emu-alg>
</emu-clause>
</emu-clause>
Expand Down
3 changes: 1 addition & 2 deletions spec/intl.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,9 @@ <h1>AvailableNamedTimeZoneIdentifiers ( ): a List of Time Zone Identifier Record
</dl>
<p>This definition supersedes the definition provided in <emu-xref href="#sec-availablenamedtimezoneidentifiers"></emu-xref>.</p>
<emu-alg>
1. Let _identifiers_ be a List containing the String value of each Zone or Link name in the IANA Time Zone Database.
1. Let _identifiers_ be a List containing the String value of each Zone or Link name in the IANA Time Zone Database, sorted according to lexicographic code unit order.
1. Assert: No element of _identifiers_ is an ASCII-case-insensitive match for any other element.
1. Assert: Every element of _identifiers_ identifies a Zone or Link name in the IANA Time Zone Database.
1. Set _identifiers_ to SortStringListByCodeUnit(_identifiers_).
1. Let _result_ be a new empty List.
1. For each element _identifier_ of _identifiers_, do
1. Let _primary_ be _identifier_.
Expand Down
58 changes: 0 additions & 58 deletions spec/mainadditions.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,6 @@ <h1>The Year-Week Record Specification Type</h1>
</emu-clause>
</ins>

<ins class="block">
<emu-clause id="sec-sortstringlistbycodeunit" type="abstract operation">
<h1>
SortStringListByCodeUnit (
_strings_: a List of Strings,
): a List of Strings
</h1>
<dl class="header">
<dt>description</dt>
<dd>The returned List contains the same Strings as _strings_, but sorted lexicographically by UTF-16 code unit in ascending order.</dd>
</dl>
<emu-alg>
1. Let _result_ be a copy of _strings_.
1. [declared="comparefn"] Sort _result_ into the same order as if an Array of the same values had been sorted using %Array.prototype.sort% with *undefined* as _comparefn_.
1. Return _result_.
</emu-alg>
</emu-clause>
</ins>

<emu-clause id="sec-mathematical-operations">
<h1>Mathematical Operations</h1>
<p>[...]</p>
Expand Down Expand Up @@ -233,45 +214,6 @@ <h1>Time Zone Identifiers</h1>
</p>
</emu-clause>

<emu-clause id="sec-availablenamedtimezoneidentifiers" type="implementation-defined abstract operation">
<h1>AvailableNamedTimeZoneIdentifiers ( ): a List of Time Zone Identifier Records</h1>
<dl class="header">
<dt>description</dt>
<dd>
Its result describes all available named time zone identifiers in this implementation, as well as the primary time zone identifier corresponding to each available named time zone identifier.
The List is ordered according to the [[Identifier]] field of each Time Zone Identifier Record.
</dd>
</dl>
<p>
Time zone aware implementations, including all implementations that implement the ECMA-402 Internationalization API, must implement the AvailableNamedTimeZoneIdentifiers abstract operation as specified in the ECMA-402 specification.
For implementations that are not time zone aware, AvailableNamedTimeZoneIdentifiers performs the following steps when called:
</p>
<emu-alg>
1. If the implementation does not include local political rules for any time zones, then
1. Return « the Time Zone Identifier Record { [[Identifier]]: *"UTC"*, [[PrimaryIdentifier]]: *"UTC"* } ».
1. Let _identifiers_ be the List of unique available named time zone identifiers.
1. <del>Sort _identifiers_ into the same order as if an Array of the same values had been sorted using %Array.prototype.sort% with *undefined* as the argument.</del>
1. <ins>Set _identifiers_ to SortStringListByCodeUnit(_identifiers_).</ins>
1. Let _result_ be a new empty List.
1. For each element _identifier_ of _identifiers_, do
1. Let _primary_ be _identifier_.
1. If _identifier_ is a non-primary time zone identifier in this implementation and _identifier_ is not *"UTC"*, then
1. Set _primary_ to the primary time zone identifier associated with _identifier_.
1. NOTE: An implementation may need to resolve _identifier_ iteratively to obtain the primary time zone identifier.
1. Let _record_ be the Time Zone Identifier Record { [[Identifier]]: _identifier_, [[PrimaryIdentifier]]: _primary_ }.
1. Append _record_ to _result_.
1. Assert: _result_ contains a Time Zone Identifier Record _r_ such that _r_.[[Identifier]] is *"UTC"* and _r_.[[PrimaryIdentifier]] is *"UTC"*.
1. Return _result_.
</emu-alg>

<emu-note>
Time zone identifiers in the IANA Time Zone Database can change over time.
At a minimum, implementations must limit changes to the result of AvailableNamedTimeZoneIdentifiers to the changes allowed by GetAvailableNamedTimeZoneIdentifier, for the lifetime of the surrounding agent.
That is, implementations must not remove support for or change the primary vs. non-primary status of an identifier that was already reported as available, and they must not add support for an identifier that was already reported as not available.
Due to the complexity of supporting these recommendations, it is recommended that the result of AvailableNamedTimeZoneIdentifiers remains the same for the lifetime of the surrounding agent.
</emu-note>
</emu-clause>

<emu-clause id="sec-systemtimezoneidentifier" oldids="sec-defaulttimezone" type="implementation-defined abstract operation">
<h1>SystemTimeZoneIdentifier ( ): a String</h1>
<dl class="header">
Expand Down

0 comments on commit 4e96961

Please sign in to comment.