2 ms·
Whether and how closures generate cycles, and consequently the best implementation strategy, depends heavily on the language, though. You might have a strictly
by evincarofautumn 9y ago
Whether 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.