3 ms·
Looks like a mutant defer, and I guess that's good? At least, there are plenty of good things about it in golang. But I have to admit I'm not looking forward to
by debatem1 3y ago
Looks like a mutant defer, and I guess that's good? At least, there are plenty of good things about it in golang. But I have to admit I'm not looking forward to debugging the inevitable function-with-mixed-defer/goto-resource-handling.
- raggi 3y agoDefer has to be added manually and maintained correctly, and often has double call challenges and so on. Automatic behavior on scope exit is less fallible (including e.g. it can’t just be broken by the machine in a pathological patch application), and has fewer logical pathologies such as double execution cases. Defer was re-popularized by go, but I think rooted in a knee jerk from bad c++. The scope mechanisms are better, as discussed and it’d be great to see them in more places.