in reply to Re^7: Yet Another Program on Closures ~ Steven Lembark ~ TPRC 2025 - YouTube
in thread Yet Another Program on Closures ~ Steven Lembark ~ TPRC 2025 - YouTube
But a (the?) central idea of closures is that of encapsulation and protection of those variables from external manipulations and other side effects.
No, it's not about protection. Quite the opposite. Capturing allows a variable to be manipulated beyond its normal lifetime. That reduces the protection the variable has compared to one that wasn't captured.
Closures are about access and life-time. Capturing attaches data to functions. In a way, closures are similar to objects which attach functions to data.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^9: Yet Another Program on Closures ~ Steven Lembark ~ TPRC 2025 - YouTube
by LanX (Saint) on Aug 04, 2025 at 20:47 UTC | |
by ikegami (Patriarch) on Aug 04, 2025 at 21:39 UTC | |
by LanX (Saint) on Aug 05, 2025 at 21:25 UTC |