3 ms·
Most circular data structures still have some node that is semantically the owner of the whole thing. Having true circular ownership is much rarer.
by int_19h 9y ago
Most circular data structures still have some node that is semantically the owner of the whole thing. Having true circular ownership is much rarer.
- amelius 9y agoClosures naturally generate cycles in the data dependency graph. A way out would be to copy the environment of a closure, but that would mean a performance penalty.
- evincarofautumn 9y agoWhether and how closures generate cycles, and consequently the best implementation strategy, depends heavily on the language, though. You might have a strictly nested call stack or thunks and continuations; shared mutable environments or immutable copies and moves; copyable environments or linear/affine closure types; boxed closures that can be stored in data structures or unboxed closures that can’t always; first-class or second-class closures; a GC to rely on or none; &c.