Re: [heycam/webidl] Link to ES for "array index" (#427)

TimothyGu commented on this pull request.



>  
-    The name of each property that appears to exist due to an object supporting indexed properties
-    is an <dfn id="dfn-array-index-property-name" export>array index property name</dfn>,
-    which is a property name |P| for which the following algorithm returns true:
+    To determine if a property name |P| <dfn lt="is an array index|is not an array index"
+    oldids="dfn-array-index-property-name">is an [=array index=]</dfn>, the following algorithm is
+    applied:
+
+    1.  If [=Type=](|P|) is not String, then return <emu-val>false</emu-val>.
+    1.  Let |index| be [=!=] <a abstract-op>CanonicalNumericIndexString</a>(|P|).
+    1.  If |index| is <emu-val>undefined</emu-val>, then return <emu-val>false</emu-val>.
+    1.  If |index| is less than 0 or is greater than or equal to 2<sup>32</sup> − 1, then return
+        <emu-val>false</emu-val>.
+    1.  Return <emu-val>true</emu-val>.

NB: the algorithm is redone in ES terms (especially the use of [CanonicalNumericIndexString](https://tc39.github.io/ecma262/#sec-canonicalnumericindexstring), which brings symmetry with [ES's definition of array index](https://tc39.github.io/ecma262/#array-index)), but it is equivalent to the old algorithm. ToUint32 does some weird manipulation with NaN, -0, Infinity, and -Infinity, and also moduloes the input against 2<sup>32</sup>, but these irregularities were normalized by the ToString check below (which is also included in CanonicalNumericIndexString).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/pull/427#pullrequestreview-58568272

Received on Friday, 25 August 2017 04:53:33 UTC