Re: [heycam/webidl] Explain why array index property names cannot be 2^32 - 1 (#409)

Because it's defined in this way in ECMAScript is what I'm guessing:

> An *integer index* is a String-valued property key that is a canonical numeric String (see [7.1.16](https://tc39.github.io/ecma262/#sec-canonicalnumericindexstring)) and whose numeric value is either **+0** or a positive integer ≤ 2<sup>53</sup> − 1. An array index is an integer index whose numeric value *i* is in the range +0 ≤ *i* < 2<sup>32</sup> − 1.
>
> Per https://tc39.github.io/ecma262/#sec-object-type

And the reason why it's defined this way is probably because of this clause:

> Every Array object has a `length` property whose value is always a nonnegative integer less than 2<sup>32</sup>. 
>
> Per https://tc39.github.io/ecma262/#sec-array-exotic-objects

If the index of the last element of an array is 2<sup>32</sup> − 1, then the length of that array would be exactly 2<sup>32</sup>.

-- 
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/issues/409#issuecomment-322442088

Received on Tuesday, 15 August 2017 11:21:47 UTC