Does Rust eliminate the cycles by copying? (expensive, and doesn't allow for writing)
Does Rust eliminate the cycles by copying? (expensive, and doesn't allow for writing)
One can't accidentally get a reference-counting cycle (values aren't reference counted unless they're put into a pointer explicitly), and a cycle of shared/mutable references won't stop deallocation (and, if it's a cycle that's unsafe, it won't compile).
Because a function's environment can end up having a reference back to the same function.
This can be set up without assignment, given just a lambda operator. Hint: look in domain name in the URL in the browser address bar.
In fact, the simple assoc list representation of environments (whereby simple consing extends the environment) does this. It doesn't eliminate circularity.
If a function has a certain binding in scope, and that binding refers back to the function, you can shuffle that binding around between different environment vectors all you want. Wherever you stick that binding, as long as the binding is in scope of that function, you have circularity.