Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upClarification: Maximum size of an array #286
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
nzakas
commented
Jan 14, 2016
|
(I'm guessing this is some back compat issue, just wanted to double-check.) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
allenwb
Jan 14, 2016
Member
Yes, it's intentional. The Array.prototype methods were generally re-specified to work with collections up to ToLength size (for example, TypedArrays can in theory be that big). But for back compact reasons Array instances are restricted to a length of 2^32-1 with Uint32 index warping.
|
Yes, it's intentional. The Array.prototype methods were generally re-specified to work with collections up to ToLength size (for example, TypedArrays can in theory be that big). But for back compact reasons Array instances are restricted to a length of 2^32-1 with Uint32 index warping. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
nzakas
commented
Jan 14, 2016
|
Cool, thanks! |
nzakas commentedJan 14, 2016
Something I noticed while reading through the spec: it appears that the maximum size of an array can now be 2^53-1 based on ToLength, which is used in several places (for example, Array.prototype.concat).
However, it looks like the
Arrayconstructor still limits the length to 2^32-1.I'm curious if this difference is intentional?