You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Editorial: Better phrasing for sorting Lists of Strings
There are a few places where Lists of Strings are sorted with the awkward
phrasing "ordered as if an Array of the same values had been sorted using
%Array.prototype.sort% using *undefined* as _comparefn_." Change the
wording of this, and add a definition in the section about List
specification types. I find this clearer about the intention (the
current language leaves it implicit that the sorting is by code unit),
and more concise.
This phrasing is used in several places in ECMA-402 as well, so this
change will bring additional benefit there.
Copy file name to clipboardExpand all lines: spec.html
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -4012,6 +4012,7 @@ <h1>The List and Record Specification Types</h1>
4012
4012
<p>When an algorithm iterates over the elements of a List without specifying an order, the order used is the order of the elements in the List.</p>
4013
4013
<p>For notational convenience within this specification, a literal syntax can be used to express a new List value. For example, « 1, 2 » defines a List value that has two elements each of which is initialized to a specific value. A new empty List can be expressed as « ».</p>
4014
4014
<p>In this specification, the phrase "the <dfn id="list-concatenation">list-concatenation</dfn> of _A_, _B_, ..." (where each argument is a possibly empty List) denotes a new List value whose elements are the concatenation of the elements (in order) of each of the arguments (in order).</p>
4015
+
<p>As applied to a List of Strings, the phrase "sorted according to <dfn id="lexicographic-code-unit-order">lexicographic code unit order</dfn>" means sorting by the numeric value of each code unit up to the length of the shorter string, and sorting the shorter string before the longer string if all are equal, as described in the abstract operation IsLessThan.</p>
4015
4016
<p>The <dfn variants="Records">Record</dfn> type is used to describe data aggregations within the algorithms of this specification. A Record type value consists of one or more named fields. The value of each field is an ECMAScript language value or specification value. Field names are always enclosed in double brackets, for example [[Value]].</p>
4016
4017
<p>For notational convenience within this specification, an object literal-like syntax can be used to express a Record value. For example, { [[Field1]]: 42, [[Field2]]: *false*, [[Field3]]: ~empty~ } defines a Record value that has three fields, each of which is initialized to a specific value. Field name order is not significant. Any fields that are not explicitly listed are considered to be absent.</p>
4017
4018
<p>In specification text and algorithms, dot notation may be used to refer to a specific field of a Record value. For example, if R is the record shown in the previous paragraph then R.[[Field2]] is shorthand for “the field of R named [[Field2]]”.</p>
A List whose elements are the String values of the exported names exposed as own properties of this object. The list is ordered as if an Array of those String values had been sorted using %Array.prototype.sort% using *undefined* as _comparefn_.
14984
+
A List whose elements are the String values of the exported names exposed as own properties of this object. The list is sorted according to lexicographic code unit order.
14984
14985
</td>
14985
14986
</tr>
14986
14987
</table>
@@ -15193,7 +15194,7 @@ <h1>
15193
15194
1. Let _M_ be MakeBasicObject(_internalSlotsList_).
15194
15195
1. Set _M_'s essential internal methods to the definitions specified in <emu-xref href="#sec-module-namespace-exotic-objects"></emu-xref>.
15195
15196
1. Set _M_.[[Module]] to _module_.
15196
-
1. [declared="comparefn"] Let _sortedExports_ be a List whose elements are the elements of _exports_ ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using *undefined* as _comparefn_.
15197
+
1. Let _sortedExports_ be a List whose elements are the elements of _exports_, sorted according to lexicographic code unit order.
15197
15198
1. Set _M_.[[Exports]] to _sortedExports_.
15198
15199
1. Create own properties of _M_ corresponding to the definitions in <emu-xref href="#sec-module-namespace-objects"></emu-xref>.
15199
15200
1. Set _module_.[[Namespace]] to _M_.
@@ -32729,8 +32730,7 @@ <h1>AvailableNamedTimeZoneIdentifiers ( ): a List of Time Zone Identifier Record
32729
32730
<emu-alg>
32730
32731
1. If the implementation does not include local political rules for any time zones, then
32731
32732
1. Return « the Time Zone Identifier Record { [[Identifier]]: *"UTC"*, [[PrimaryIdentifier]]: *"UTC"* } ».
32732
-
1. Let _identifiers_ be the List of unique available named time zone identifiers.
32733
-
1. [declared="comparefn"] Sort _identifiers_ into the same order as if an Array of the same values had been sorted using %Array.prototype.sort% with *undefined* as _comparefn_.
32733
+
1. Let _identifiers_ be the List of unique available named time zone identifiers, sorted according to lexicographic code unit order.
32734
32734
1. Let _result_ be a new empty List.
32735
32735
1. For each element _identifier_ of _identifiers_, do
0 commit comments