Skip to content

Commit 2a77f67

Browse files
authored
Editorial Changes to Align with 262 (#120)
* upgrading ecmarkup * preparing the spec to rename internal slots to start with uppercase character. this change allows a clear separation between internal slot names and properties/fields used across the spec as in [[<name>]]. This change does not change any semantic or any logic, it only adds internal slot column in table 4 and table 2 to have a clear distintion between property and internal slot names. * editorial: alignment with 262 by naming all internal slots to start with uppercase characters. This change does not change any semantic or any logic.
1 parent 947aa9a commit 2a77f67

File tree

6 files changed

+203
-191
lines changed

6 files changed

+203
-191
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ env:
88
language: node_js
99

1010
node_js:
11-
- "5"
11+
- "6"
1212

1313
sudo: false

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"license": "SEE LICENSE IN https://tc39.github.io/ecma402/#sec-copyright-and-software-license",
1818
"homepage": "https://tc39.github.io/ecma402/",
1919
"dependencies": {
20-
"ecmarkup": "^3.3.2"
20+
"ecmarkup": "^3.4.0"
2121
},
2222
"devDependencies": {
2323
"@alrra/travis-scripts": "^2.0.0"

spec/collator.html

+47-45
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,31 @@ <h1>InitializeCollator ( _collator_, _locales_, _options_ )</h1>
1515
</p>
1616

1717
<p>
18-
Several steps in the algorithm use values from the following table, which associates Unicode locale extension keys, property names, types, and allowable values:
18+
Several steps in the algorithm use values from the following table, which associates Unicode locale extension keys, internal slots, property names, types, and allowable values:
1919
</p>
2020

2121
<emu-table id="table-collator-options">
22-
<emu-caption>Collator options settable through both extension keys and options properties</emu-caption>
22+
<emu-caption>Collator options settable through extension keys, internal slots and options properties</emu-caption>
2323
<table class="real-table">
2424
<thead>
2525
<tr>
2626
<th>Key</th>
27+
<th>Internal Slot</th>
2728
<th>Property</th>
2829
<th>Type</th>
2930
<th>Values</th>
3031
</tr>
3132
</thead>
3233
<tr>
3334
<td>kn</td>
35+
<td>[[Numeric]]</td>
3436
<td>numeric</td>
3537
<td>"boolean"</td>
3638
<td></td>
3739
</tr>
3840
<tr>
3941
<td>kf</td>
42+
<td>[[CaseFirst]]</td>
4043
<td>caseFirst</td>
4144
<td>"string"</td>
4245
<td>"upper", "lower", "false"</td>
@@ -48,19 +51,19 @@ <h1>InitializeCollator ( _collator_, _locales_, _options_ )</h1>
4851
</p>
4952

5053
<emu-alg>
51-
1. If _collator_.[[initializedIntlObject]] is *true*, throw a *TypeError* exception.
52-
1. Set _collator_.[[initializedIntlObject]] to *true*.
54+
1. If _collator_.[[InitializedIntlObject]] is *true*, throw a *TypeError* exception.
55+
1. Set _collator_.[[InitializedIntlObject]] to *true*.
5356
1. Let _requestedLocales_ be ? CanonicalizeLocaleList(_locales_).
5457
1. If _options_ is *undefined*, then
5558
1. Let _options_ be ObjectCreate(%ObjectPrototype%).
5659
1. Else,
5760
1. Let _options_ be ? ToObject(_options_).
5861
1. Let _u_ be ? GetOption(_options_, *"usage"*, *"string"*, &laquo; *"sort"*, *"search"* &raquo;, *"sort"*).
59-
1. Set _collator_.[[usage]] to _u_.
62+
1. Set _collator_.[[Usage]] to _u_.
6063
1. If _u_ is *"sort"*, then
61-
1. Let _localeData_ be %Collator%.[[sortLocaleData]].
64+
1. Let _localeData_ be %Collator%.[[SortLocaleData]].
6265
1. Else,
63-
1. Let _localeData_ be %Collator%.[[searchLocaleData]].
66+
1. Let _localeData_ be %Collator%.[[SearchLocaleData]].
6467
1. Let _opt_ be a new Record.
6568
1. Let _matcher_ be ? GetOption(_options_, *"localeMatcher"*, *"string"*, &laquo; *"lookup"*, *"best fit"* &raquo;, *"best fit"*).
6669
1. Set _opt_.[[localeMatcher]] to _matcher_.
@@ -73,23 +76,22 @@ <h1>InitializeCollator ( _collator_, _locales_, _options_ )</h1>
7376
1. If the string given in the Type column of the row is *"boolean"* and value is not *undefined*, then
7477
1. Let _value_ be ! ToString(_value_).
7578
1. Set _opt_.[[&lt;_key_&gt;]] to _value_.
76-
1. Let _relevantExtensionKeys_ be %Collator%.[[relevantExtensionKeys]].
77-
1. Let _r_ be ResolveLocale(%Collator%.[[availableLocales]], _requestedLocales_, _opt_, _relevantExtensionKeys_, _localeData_).
78-
1. Set _collator_.[[locale]] to _r_.[[locale]].
79+
1. Let _relevantExtensionKeys_ be %Collator%.[[RelevantExtensionKeys]].
80+
1. Let _r_ be ResolveLocale(%Collator%.[[AvailableLocales]], _requestedLocales_, _opt_, _relevantExtensionKeys_, _localeData_).
81+
1. Set _collator_.[[Locale]] to _r_.[[locale]].
7982
1. Let _k_ be 0.
8083
1. Let _rExtensionKeys_ be CreateArrayFromList(_relevantExtensionKeys_).
8184
1. Let _len_ be ! ToLength(! Get(_rExtensionKeys_, *"length"*)).
8285
1. Repeat while _k_ < _len_:
8386
1. Let _key_ be ! Get(_rExtensionKeys_, ! ToString(_k_)).
8487
1. If _key_ is *"co"*, then
85-
1. Let _property_ be *"collation"*.
8688
1. Let _value_ be _r_.[[co]].
8789
1. If _value_ is *null*, let _value_ be *"default"*.
90+
1. Set _collator_.[[Collation]] to _value_.
8891
1. Else use the row of <emu-xref href="#table-collator-options"></emu-xref> that contains _key_ in the Key column:
89-
1. Let _property_ be the name given in the Property column of the row.
9092
1. Let _value_ be _r_.[[&lt;_key_&gt;]].
9193
1. If the name given in the Type column of the row is *"boolean"*, let _value_ be the result of comparing value with *"true"*.
92-
1. Set _collator_.[[&lt;_property_&gt;]] to _value_.
94+
1. Set _collator_'s internal slot whose name is the Internal Slot column of the row to _value_.
9395
1. Increase _k_ by 1.
9496
1. Let _s_ be ? GetOption(_options_, *"sensitivity"*, *"string"*, &laquo; *"base"*, *"accent"*, *"case"*, *"variant"* &raquo;, *undefined*).
9597
1. If _s_ is *undefined*, then
@@ -99,11 +101,11 @@ <h1>InitializeCollator ( _collator_, _locales_, _options_ )</h1>
99101
1. Let _dataLocale_ be _r_.[[dataLocale]].
100102
1. Let _dataLocaleData_ be Get(_localeData_, _dataLocale_).
101103
1. Let _s_ be Get(_dataLocaleData_, *"sensitivity"*).
102-
1. Set _collator_.[[sensitivity]] to _s_.
104+
1. Set _collator_.[[Sensitivity]] to _s_.
103105
1. Let _ip_ be ? GetOption(_options_, *"ignorePunctuation"*, *"boolean"*, *undefined*, *false*).
104-
1. Set _collator_.[[ignorePunctuation]] to _ip_.
105-
1. Set _collator_.[[boundCompare]] to *undefined*.
106-
1. Set _collator_.[[initializedCollator]] to *true*.
106+
1. Set _collator_.[[IgnorePunctuation]] to _ip_.
107+
1. Set _collator_.[[BoundCompare]] to *undefined*.
108+
1. Set _collator_.[[InitializedCollator]] to *true*.
107109
1. Return _collator_.
108110
</emu-alg>
109111

@@ -118,11 +120,11 @@ <h1>Intl.Collator ( [ _locales_ [ , _options_ ] ] )</h1>
118120

119121
<emu-alg>
120122
1. If NewTarget is *undefined*, let _newTarget_ be the active function object, else let _newTarget_ be NewTarget.
121-
1. Let _internalSlotsList_ be &laquo; [[initializedIntlObject]], [[initializedCollator]], [[locale]], [[usage]], [[sensitivity]], [[ignorePunctuation]], [[collation]], [[boundCompare]] &raquo;.
122-
1. If %Collator%.[[relevantExtensionKeys]] contains `"kn"`, then
123-
1. Append [[numeric]] as the last element of _internalSlotsList_.
124-
1. If %Collator%.[[relevantExtensionKeys]] contains `"kf"`, then
125-
1. Append [[caseFirst]] as the last element of _internalSlotsList_.
123+
1. Let _internalSlotsList_ be &laquo; [[InitializedIntlObject]], [[InitializedCollator]], [[Locale]], [[Usage]], [[Sensitivity]], [[IgnorePunctuation]], [[Collation]], [[BoundCompare]] &raquo;.
124+
1. If %Collator%.[[RelevantExtensionKeys]] contains `"kn"`, then
125+
1. Append [[Numeric]] as the last element of _internalSlotsList_.
126+
1. If %Collator%.[[RelevantExtensionKeys]] contains `"kf"`, then
127+
1. Append [[CaseFirst]] as the last element of _internalSlotsList_.
126128
1. Let _collator_ be ? OrdinaryCreateFromConstructor(_newTarget_, `"%CollatorPrototype%"`, _internalSlotsList_).
127129
1. Return ? InitializeCollator(_collator_, _locales_, _options_).
128130
</emu-alg>
@@ -157,7 +159,7 @@ <h1>Intl.Collator.supportedLocalesOf ( _locales_ [ , _options_ ] )</h1>
157159

158160
<emu-alg>
159161
1. Let _requestedLocales_ be ? CanonicalizeLocaleList(_locales_).
160-
1. Return ? SupportedLocales(%Collator%.[[availableLocales]], _requestedLocales_, _options_).
162+
1. Return ? SupportedLocales(%Collator%.[[AvailableLocales]], _requestedLocales_, _options_).
161163
</emu-alg>
162164

163165
<p>
@@ -169,21 +171,21 @@ <h1>Intl.Collator.supportedLocalesOf ( _locales_ [ , _options_ ] )</h1>
169171
<h1>Internal Slots</h1>
170172

171173
<p>
172-
The value of the [[availableLocales]] internal slot is implementation defined within the constraints described in 9.1. The value of the [[relevantExtensionKeys]] internal slot is a List that must include the element *"co"*, may include any or all of the elements *"kn"* and *"kf"*, and must not include any other elements.
174+
The value of the [[AvailableLocales]] internal slot is implementation defined within the constraints described in 9.1. The value of the [[RelevantExtensionKeys]] internal slot is a List that must include the element *"co"*, may include any or all of the elements *"kn"* and *"kf"*, and must not include any other elements.
173175
</p>
174176

175177
<emu-note>
176178
Unicode Technical Standard 35 describes ten locale extension keys that are relevant to collation: "co" for collator usage and specializations, "ka" for alternate handling, "kb" for backward second level weight, "kc" for case level, "kn" for numeric, "kh" for hiragana quaternary, "kk" for normalization, "kf" for case first, "kr" for reordering, "ks" for collation strength, and "vt" for variable top. Collator, however, requires that the usage is specified through the usage property of the options object, alternate handling through the ignorePunctuation property of the options object, and case level and the strength through the sensitivity property of the options object. The "co" key in the language tag is supported only for collator specializations, and the keys "kb", "kh", "kk", "kr", and "vt" are not allowed in this version of the Internationalization API. Support for the remaining keys is implementation dependent.
177179
</emu-note>
178180

179181
<p>
180-
The values of the [[sortLocaleData]] and [[searchLocaleData]] internal slots are implementation defined within the constraints described in 9.1 and the following additional constraints:
182+
The values of the [[SortLocaleData]] and [[SearchLocaleData]] internal slots are implementation defined within the constraints described in 9.1 and the following additional constraints:
181183
</p>
182184

183185
<ul>
184-
<li>The first element of [[sortLocaleData]][locale].co and [[searchLocaleData]][locale].co must be *null* for all locale values.</li>
185-
<li>The values *"standard"* and *"search"* must not be used as elements in any [[sortLocaleData]][locale].co and [[searchLocaleData]][locale].co array.</li>
186-
<li>[[searchLocaleData]][locale] must have a sensitivity property with a String value equal to *"base"*, *"accent"*, *"case"*, or *"variant"* for all locale values.</li>
186+
<li>The first element of [[SortLocaleData]][locale].co and [[SearchLocaleData]][locale].co must be *null* for all locale values.</li>
187+
<li>The values *"standard"* and *"search"* must not be used as elements in any [[SortLocaleData]][locale].co and [[SearchLocaleData]][locale].co array.</li>
188+
<li>[[SearchLocaleData]][locale] must have a sensitivity property with a String value equal to *"base"*, *"accent"*, *"case"*, or *"variant"* for all locale values.</li>
187189
</ul>
188190

189191
</emu-clause>
@@ -197,7 +199,7 @@ <h1>Properties of the Intl.Collator Prototype Object</h1>
197199
</p>
198200

199201
<p>
200-
In the following descriptions of functions that are properties or [[Get]] attributes of properties of %CollatorPrototype%, the phrase "this Collator object" refers to the object that is the *this* value for the invocation of the function; a *TypeError* exception is thrown if the this value is not an object or an object that does not have an [[initializedCollator]] internal slot with value *true*.
202+
In the following descriptions of functions that are properties or [[Get]] attributes of properties of %CollatorPrototype%, the phrase "this Collator object" refers to the object that is the *this* value for the invocation of the function; a *TypeError* exception is thrown if the this value is not an object or an object that does not have an [[InitializedCollator]] internal slot with value *true*.
201203
</p>
202204

203205
<emu-clause id="sec-intl.collator.prototype.constructor">
@@ -233,13 +235,13 @@ <h1>get Intl.Collator.prototype.compare</h1>
233235
<emu-alg>
234236
1. Let _collator_ be *this* value.
235237
1. If Type(_collator_) is not Object, throw a *TypeError* exception.
236-
1. If _collator_ does not have an [[initializedCollator]] internal slot, throw a *TypeError* exception.
237-
1. If _collator_.[[boundCompare]] is *undefined*, then
238+
1. If _collator_ does not have an [[InitializedCollator]] internal slot, throw a *TypeError* exception.
239+
1. If _collator_.[[BoundCompare]] is *undefined*, then
238240
1. Let _F_ be a new built-in function object as defined in <emu-xref href="#sec-collator-compare-functions"></emu-xref>.
239241
1. Let _bc_ be BoundFunctionCreate(_F_, _collator_, &laquo; &raquo;).
240242
1. Perform ! DefinePropertyOrThrow(_bc_, `"length"`, PropertyDescriptor {[[Value]]: 2, [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true*}).
241-
1. Set _collator_.[[boundCompare]] to _bc_.
242-
1. Return _collator_.[[boundCompare]].
243+
1. Set _collator_.[[BoundCompare]] to _bc_.
244+
1. Return _collator_.[[BoundCompare]].
243245
</emu-alg>
244246

245247
<emu-note>
@@ -260,7 +262,7 @@ <h1>Collator Compare Functions</h1>
260262

261263
<emu-alg>
262264
1. Let _collator_ be the *this* value.
263-
1. Assert: Type(_collator_) is Object and _collator_ .[[initializedCollator]] is *true*.
265+
1. Assert: Type(_collator_) is Object and _collator_ .[[InitializedCollator]] is *true*.
264266
1. If _x_ is not provided, let _x_ be *undefined*.
265267
1. If _y_ is not provided, let _y_ be *undefined*.
266268
1. Let _X_ be ? ToString(_x_).
@@ -320,7 +322,7 @@ <h1>Intl.Collator.prototype.resolvedOptions ()</h1>
320322
This function provides access to the locale and collation options computed during initialization of the object.
321323
</p>
322324
<p>
323-
The function returns a new object whose properties and attributes are set as if constructed by an object literal assigning to each of the following properties the value of the corresponding internal slot of this Collator object (see <emu-xref href="#sec-properties-of-intl-collator-instances"></emu-xref>): locale, usage, sensitivity, ignorePunctuation, collation, as well as those properties shown in <emu-xref href="#table-collator-options"></emu-xref> whose keys are included in the %Collator%[[relevantExtensionKeys]] internal slot of the standard built-in object that is the initial value of Intl.Collator.
325+
The function returns a new object whose properties and attributes are set as if constructed by an object literal assigning to each of the following properties the value of the corresponding internal slot of this Collator object (see <emu-xref href="#sec-properties-of-intl-collator-instances"></emu-xref>): locale, usage, sensitivity, ignorePunctuation, collation, as well as those properties shown in <emu-xref href="#table-collator-options"></emu-xref> whose keys are included in the %Collator%.[[RelevantExtensionKeys]] internal slot of the standard built-in object that is the initial value of Intl.Collator.
324326
</p>
325327
</emu-clause>
326328
</emu-clause>
@@ -333,32 +335,32 @@ <h1>Properties of Intl.Collator Instances</h1>
333335
</p>
334336

335337
<p>
336-
Intl.Collator instances and other objects that have been successfully initialized as a Collator have [[initializedIntlObject]] and [[initializedCollator]] internal slots whose values are *true*.
338+
Intl.Collator instances and other objects that have been successfully initialized as a Collator have [[InitializedIntlObject]] and [[InitializedCollator]] internal slots whose values are *true*.
337339
</p>
338340

339341
<p>
340342
Objects that have been successfully initialized as a Collator also have several internal slots that are computed by the constructor:
341343
</p>
342344

343345
<ul>
344-
<li>[[locale]] is a String value with the language tag of the locale whose localization is used for collation.</li>
345-
<li>[[usage]] is one of the String values *"sort"* or *"search"*, identifying the collator usage.</li>
346-
<li>[[sensitivity]] is one of the String values *"base"*, *"accent"*, *"case"*, or *"variant"*, identifying the collator’s sensitivity.</li>
347-
<li>[[ignorePunctuation]] is a Boolean value, specifying whether punctuation should be ignored in comparisons.</li>
348-
<li>[[collation]] is a String value with the "type" given in Unicode Technical Standard 35 for the collation, except that the values *"standard"* and *"search"* are not allowed, while the value *"default"* is allowed.</li>
346+
<li>[[Locale]] is a String value with the language tag of the locale whose localization is used for collation.</li>
347+
<li>[[Usage]] is one of the String values *"sort"* or *"search"*, identifying the collator usage.</li>
348+
<li>[[Sensitivity]] is one of the String values *"base"*, *"accent"*, *"case"*, or *"variant"*, identifying the collator’s sensitivity.</li>
349+
<li>[[IgnorePunctuation]] is a Boolean value, specifying whether punctuation should be ignored in comparisons.</li>
350+
<li>[[Collation]] is a String value with the "type" given in Unicode Technical Standard 35 for the collation, except that the values *"standard"* and *"search"* are not allowed, while the value *"default"* is allowed.</li>
349351
</ul>
350352

351353
<p>
352-
Objects that have been successfully initialized as a Collator also have the following internal slots if the key corresponding to the name of the internal slot in <emu-xref href="#table-collator-options"></emu-xref> is included in the [[relevantExtensionKeys]] internal slot of Intl.Collator:
354+
Objects that have been successfully initialized as a Collator also have the following internal slots if the key corresponding to the name of the internal slot in <emu-xref href="#table-collator-options"></emu-xref> is included in the [[RelevantExtensionKeys]] internal slot of Intl.Collator:
353355
</p>
354356

355357
<ul>
356-
<li>[[numeric]] is a Boolean value, specifying whether numeric sorting is used.</li>
357-
<li>[[caseFirst]] is a String value; allowed values are specified in <emu-xref href="#table-collator-options"></emu-xref>.</li>
358+
<li>[[Numeric]] is a Boolean value, specifying whether numeric sorting is used.</li>
359+
<li>[[CaseFirst]] is a String value; allowed values are specified in <emu-xref href="#table-collator-options"></emu-xref>.</li>
358360
</ul>
359361

360362
<p>
361-
Finally, objects that have been successfully initialized as a Collator have a [[boundCompare]] internal slot that caches the function returned by the compare accessor (<emu-xref href="#sec-intl.collator.prototype.compare"></emu-xref>).
363+
Finally, objects that have been successfully initialized as a Collator have a [[BoundCompare]] internal slot that caches the function returned by the compare accessor (<emu-xref href="#sec-intl.collator.prototype.compare"></emu-xref>).
362364
</p>
363365

364366
</emu-clause>

0 commit comments

Comments
 (0)