Hi, can someone who's more knowledgeable about Roc's internals contribute to this thread on Mastodon?
Well I think the new site answers some of this in the Fast, Friendly and Functional pages... but it's not quite released yet. It's WIP and should be done very soon. https://www.roc-lang.org/wip/
I wouldn't be confident enough to give an answer directly. I assume this is related to opportunistic in place mutations.
@Hannes I'd say link to https://vimeo.com/653510682 at like the 32:30 mark (that talk goes into the technical details of how basically everything in Roc is implemented except I think dictionaries and sets maybe?)
but yeah short answer is:
List
basically looks like a Rust Vec
or a C++ std::vector
except with a reference count added to the heap allocation (and also seamless slice support, but that's not really relevant to the question)so yeah it's in place, not cloning, but if the reference count were more than 1, then the whole thing would be cloned
Thanks Richard, I've replied in the thread with that info :+1:
Hannes has marked this topic as resolved.
Ryan Bates has marked this topic as unresolved.
Ryan Bates has marked this topic as resolved.
Last updated: Jul 06 2025 at 12:14 UTC