as I understand, it is currently impossible to represent a doubly linked list in roc due to it requiring ref cycles which roc disallows
would it always be the case or at some point will roc try to integrate a cycle detector?
im totally fine with _absolutely not_, because it does add complexity and a performance penalty which idk if needed, as i've never seen a use for something _like_ doubly linked lists outside of homework
just wondering about goals here
we can use opaque types to prevent things (such as list nodes) to be promiscuously referenced,
combine this with weak ref and we can have cyclic ref without needing cycle detector
which can be useful for lots of data types, even if deque is considered good-for-nothing
this of course needs the "hey we can do in-place mutation here"-detector working to be useful, otherwise it's moot point
interesting
I'm pretty sure cycles of this nature are explicitly not allowed in the language with no plans of being added
The only ways to get a doubly linked list in roc would be up either
dank said:
at some point will roc try to integrate a cycle detector?
the current plan is never to do this - I think if there was a lot of demand for a specific data structure (e.g. a doubly linked list), the discussion would be whether we can (and if so whether we should) add a builtin to address the use case
another possibility is being able to optimize our way into it, but that seems less likely to work out in practice :big_smile:
Last updated: Jul 05 2025 at 12:14 UTC