New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification: Maximum size of an array #286

Closed
nzakas opened this Issue Jan 14, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@nzakas

nzakas commented Jan 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 Array constructor still limits the length to 2^32-1.

I'm curious if this difference is intentional?

@nzakas

This comment has been minimized.

Show comment
Hide comment
@nzakas

nzakas Jan 14, 2016

(I'm guessing this is some back compat issue, just wanted to double-check.)

nzakas commented Jan 14, 2016

(I'm guessing this is some back compat issue, just wanted to double-check.)

@allenwb

This comment has been minimized.

Show comment
Hide comment
@allenwb

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.

Member

allenwb commented Jan 14, 2016

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.

@nzakas

This comment has been minimized.

Show comment
Hide comment
@nzakas

nzakas Jan 14, 2016

Cool, thanks!

nzakas commented Jan 14, 2016

Cool, thanks!

@nzakas nzakas closed this Jan 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment