2 ms·
"Cyclic datagraphs bad" is a perfect example of religious Rust brainwashing. Cyclic structures in memory are not bad just because the one-memory-management-tri
by kazinator 2y ago
"Cyclic datagraphs bad" is a perfect example of religious Rust brainwashing.
Cyclic structures in memory are not bad just because the one-memory-management-trick pony language you're currently infatuated with doesn't handle them within its safety paradigm.
Graph structures are entirely legitimate in computer science, and are handled nicely by garbage collection which is the gold standard in memory management.
Fully general lexical closures lead to cycles even when no variables are mutated. And even if no circular definitions are supported in the language.
We can use the Y combinator to create a cycle: a situation when a function's captured environment contains a binding whose value is that function itself.