3 ms·
This seems to be the same as having everything in the subgraph be "owned" by the owning pointer. Which would be a special case of the Rusty "ownership forms a t
by zozbot234 7y ago
This seems to be the same as having everything in the subgraph be "owned" by the owning pointer. Which would be a special case of the Rusty "ownership forms a tree" model. The key is that because ownership within the subgraph is explicitly untracked, you can only really drop the whole subgraph at once. Supporting this idiomatically in Rust should become quite a bit easier once custom, non-global allocators (like in C++) are allowed, since these are often used for the same things anyway.
- rayiner 7y agoIt's not quite supported in Rust, as far as I understand it. Say I have two local variables: 'ptr' and 'itr.' 'ptr' is an owning pointer to a region containing a cyclic graph. 'itr' is a pointer to a node in the graph. What is the type of 'itr' in Rust?
- pcwalton 7y agoAssuming you're using a region crate like bumpalo, the type of itr is &'a T, where 'a is the lifetime of ptr. This means that ptr has to be anchored in a stack frame. I haven't looked at Verona specifically, but region systems all have this restriction (for example, ML Kit, the originator of regions, required a lexical "letregion" construct), unless they use dependent types.