3 ms·
> In GC it happens some time later. Yes. In languages with destructors/finalizers called from the garbage collector, things can get very complicated. C# and Ja
by Animats 4y ago
> In GC it happens some time later.
Yes. In languages with destructors/finalizers called from the garbage collector, things can get very complicated. C# and Java have this problem.
Go avoids it by having scope-based "defer" rather than destructors.
- pjmlp 4y agoJava has scope based defer since version 7, while C# has it since version 4, with the improvement on version 8 to be syntactically like defer. With a bit of generics and lambdas, they can be made to even be more defer like.