8 ms·
What would be the use of closing over the value rather than the variable? That would stop a lot of interesting use of closed-over variables (like persisting val
by randomswede 4y ago
What would be the use of closing over the value rather than the variable? That would stop a lot of interesting use of closed-over variables (like persisting values from call to call).
- masklinn 4y agoIn fairness while that would be a lot less convenient in reference-based langages in Go you could just close over a pointer to the variable, making the relationship explicit. That’s how you’d do it using a [=] lambda in c++ or a move closure in rust.