News for hackers. Stuff that matters.
Re:Reference count, don't garbage collect by Animats on Saturday July 30, 2022 @04:01AM (#32285141)
> 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.

Re:Reference count, don't garbage collect by pjmlp on Saturday July 30, 2022 @04:44AM (#32285277)
Java 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.