Skip to content

Commit f660b14

Browse files
michaelficarraljharb
authored andcommitted
Editorial: get rid of BigInt::sameValue and BigInt::sameValueZero (#2867)
1 parent 9a5caa4 commit f660b14

File tree

1 file changed

+20
-60
lines changed

1 file changed

+20
-60
lines changed

spec.html

Lines changed: 20 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,43 +1627,33 @@ <h1>Numeric Types</h1>
16271627
<td>
16281628
Number::sameValue
16291629
</td>
1630-
<td rowspan="2">
1630+
<td>
16311631
`Object.is(x, y)`
16321632
</td>
1633-
<td rowspan="2">
1633+
<td>
16341634
Object internal methods,
16351635
via <emu-xref href="#sec-samevalue" title></emu-xref>,
16361636
to test exact value equality
16371637
</td>
1638-
<td rowspan="2">
1639-
Boolean
1640-
</td>
1641-
</tr>
1642-
<tr>
16431638
<td>
1644-
BigInt::sameValue
1639+
Boolean
16451640
</td>
16461641
</tr>
16471642

16481643
<tr>
16491644
<td>
16501645
Number::sameValueZero
16511646
</td>
1652-
<td rowspan="2">
1647+
<td>
16531648
`[x].includes(y)`
16541649
</td>
1655-
<td rowspan="2">
1650+
<td>
16561651
Array, Map, and Set methods,
16571652
via <emu-xref href="#sec-samevaluezero" title></emu-xref>,
16581653
to test value equality, ignoring the difference between *+0*<sub>𝔽</sub> and *-0*<sub>𝔽</sub>
16591654
</td>
1660-
<td rowspan="2">
1661-
Boolean
1662-
</td>
1663-
</tr>
1664-
<tr>
16651655
<td>
1666-
BigInt::sameValueZero
1656+
Boolean
16671657
</td>
16681658
</tr>
16691659

@@ -2459,7 +2449,7 @@ <h1>
24592449
</emu-alg>
24602450
</emu-clause>
24612451

2462-
<emu-clause id="sec-numeric-types-bigint-equal" type="numeric method">
2452+
<emu-clause id="sec-numeric-types-bigint-equal" type="numeric method" oldids="sec-numeric-types-bigint-sameValue,sec-numeric-types-bigint-sameValueZero">
24632453
<h1>
24642454
BigInt::equal (
24652455
_x_: a BigInt,
@@ -2473,34 +2463,6 @@ <h1>
24732463
</emu-alg>
24742464
</emu-clause>
24752465

2476-
<emu-clause id="sec-numeric-types-bigint-sameValue" type="numeric method">
2477-
<h1>
2478-
BigInt::sameValue (
2479-
_x_: a BigInt,
2480-
_y_: a BigInt,
2481-
): a Boolean
2482-
</h1>
2483-
<dl class="header">
2484-
</dl>
2485-
<emu-alg>
2486-
1. Return BigInt::equal(_x_, _y_).
2487-
</emu-alg>
2488-
</emu-clause>
2489-
2490-
<emu-clause id="sec-numeric-types-bigint-sameValueZero" type="numeric method">
2491-
<h1>
2492-
BigInt::sameValueZero (
2493-
_x_: a BigInt,
2494-
_y_: a BigInt,
2495-
): a Boolean
2496-
</h1>
2497-
<dl class="header">
2498-
</dl>
2499-
<emu-alg>
2500-
1. Return BigInt::equal(_x_, _y_).
2501-
</emu-alg>
2502-
</emu-clause>
2503-
25042466
<emu-clause id="sec-binaryand" type="abstract operation">
25052467
<h1>
25062468
BinaryAnd (
@@ -6054,9 +6016,7 @@ <h1>
60546016
1. If Type(_x_) is different from Type(_y_), return *false*.
60556017
1. If Type(_x_) is Number, then
60566018
1. Return Number::sameValue(_x_, _y_).
6057-
1. If Type(_x_) is BigInt, then
6058-
1. Return BigInt::sameValue(_x_, _y_).
6059-
1. Return SameValueNonNumeric(_x_, _y_).
6019+
1. Return SameValueNonNumber(_x_, _y_).
60606020
</emu-alg>
60616021
<emu-note>
60626022
<p>This algorithm differs from the IsStrictlyEqual Algorithm by treating all *NaN* values as equivalent and by differentiating *+0*<sub>𝔽</sub> from *-0*<sub>𝔽</sub>.</p>
@@ -6078,26 +6038,26 @@ <h1>
60786038
1. If Type(_x_) is different from Type(_y_), return *false*.
60796039
1. If Type(_x_) is Number, then
60806040
1. Return Number::sameValueZero(_x_, _y_).
6081-
1. If Type(_x_) is BigInt, then
6082-
1. Return BigInt::sameValueZero(_x_, _y_).
6083-
1. Return SameValueNonNumeric(_x_, _y_).
6041+
1. Return SameValueNonNumber(_x_, _y_).
60846042
</emu-alg>
60856043
<emu-note>
60866044
<p>SameValueZero differs from SameValue only in that it treats *+0*<sub>𝔽</sub> and *-0*<sub>𝔽</sub> as equivalent.</p>
60876045
</emu-note>
60886046
</emu-clause>
60896047

6090-
<emu-clause id="sec-samevaluenonnumeric" type="abstract operation" oldids="sec-samevaluenonnumber">
6048+
<emu-clause id="sec-samevaluenonnumber" type="abstract operation" oldids="sec-samevaluenonnumeric">
60916049
<h1>
6092-
SameValueNonNumeric (
6093-
_x_: an ECMAScript language value, but not a Number or a BigInt,
6094-
_y_: an ECMAScript language value, but not a Number or a BigInt,
6050+
SameValueNonNumber (
6051+
_x_: an ECMAScript language value, but not a Number,
6052+
_y_: an ECMAScript language value, but not a Number,
60956053
): a Boolean
60966054
</h1>
60976055
<dl class="header">
60986056
</dl>
60996057
<emu-alg>
61006058
1. Assert: Type(_x_) is the same as Type(_y_).
6059+
1. If Type(_x_) is BigInt, then
6060+
1. Return BigInt::equal(_x_, _y_).
61016061
1. If Type(_x_) is Undefined, return *true*.
61026062
1. If Type(_x_) is Null, return *true*.
61036063
1. If Type(_x_) is String, then
@@ -6221,9 +6181,7 @@ <h1>
62216181
1. If Type(_x_) is different from Type(_y_), return *false*.
62226182
1. If Type(_x_) is Number, then
62236183
1. Return Number::equal(_x_, _y_).
6224-
1. If Type(_x_) is BigInt, then
6225-
1. Return BigInt::equal(_x_, _y_).
6226-
1. Return SameValueNonNumeric(_x_, _y_).
6184+
1. Return SameValueNonNumber(_x_, _y_).
62276185
</emu-alg>
62286186
<emu-note>
62296187
<p>This algorithm differs from the SameValue Algorithm in its treatment of signed zeroes and NaNs.</p>
@@ -33701,7 +33659,8 @@ <h1>String.prototype.endsWith ( _searchString_ [ , _endPosition_ ] )</h1>
3370133659
1. Let _start_ be _end_ - _searchLength_.
3370233660
1. If _start_ &lt; 0, return *false*.
3370333661
1. Let _substring_ be the substring of _S_ from _start_ to _end_.
33704-
1. Return SameValueNonNumeric(_substring_, _searchStr_).
33662+
1. If _substring_ is _searchStr_, return *true*.
33663+
1. Return *false*.
3370533664
</emu-alg>
3370633665
<emu-note>
3370733666
<p>This method returns *true* if the sequence of code units of _searchString_ converted to a String is the same as the corresponding code units of this object (converted to a String) starting at _endPosition_ - length(this). Otherwise it returns *false*.</p>
@@ -34236,7 +34195,8 @@ <h1>String.prototype.startsWith ( _searchString_ [ , _position_ ] )</h1>
3423634195
1. Let _end_ be _start_ + _searchLength_.
3423734196
1. If _end_ &gt; _len_, return *false*.
3423834197
1. Let _substring_ be the substring of _S_ from _start_ to _end_.
34239-
1. Return SameValueNonNumeric(_substring_, _searchStr_).
34198+
1. If _substring_ is _searchStr_, return *true*.
34199+
1. Return *false*.
3424034200
</emu-alg>
3424134201
<emu-note>
3424234202
<p>This method returns *true* if the sequence of code units of _searchString_ converted to a String is the same as the corresponding code units of this object (converted to a String) starting at index _position_. Otherwise it returns *false*.</p>

0 commit comments

Comments
 (0)