3 ms·
Java's solution to this problem is maybe the simplest and most elegant: The compiler simply won't let you reassign to a local variable after it's been closed ov
by ameliaquining 5y ago
Java's solution to this problem is maybe the simplest and most elegant: The compiler simply won't let you reassign to a local variable after it's been closed over. I think Go erred by not doing this. (Although I guess it would have complicated things a little because Go has mutable value types, so you'd need to figure out how to handle those.)