Stream: beginners

Topic: max List length


view this post on Zulip timotree (Mar 29 2024 at 17:35):

Why do the docs for List.len say

One List can store up to 2,147,483,648 elements (just over 2 billion), which is exactly equal to the highest valid #I32 value. This means the #U32 this function returns can always be safely converted to an #I32 without losing any data.

I would've thought that, at least on a 64-bit machine, the maximum length would be closer to 2^63, and this expectation seems to be backed up by the design document for seamless slices. 2 billion items is very possible to reach by accident, so I don't think that limit would be a good choice for a correctness-oriented language like Roc

view this post on Zulip Brendan Hansknecht (Mar 29 2024 at 18:52):

Docs are wrong unless you are on a 32bit system

view this post on Zulip Richard Feldman (Mar 29 2024 at 18:52):

yeah looks like there was a mistaken edit there

view this post on Zulip Richard Feldman (Mar 29 2024 at 18:53):

that part is true on 32-bit targets but not on 64-bit targets

view this post on Zulip Richard Feldman (Mar 29 2024 at 18:53):

so it should be updated!

view this post on Zulip Anton (Mar 30 2024 at 13:48):

Fixed in PR#6612 :)


Last updated: Jul 06 2025 at 12:14 UTC