News for hackers. Stuff that matters.
Re:Reference count, don't garbage collect by viktorcode on Saturday July 30, 2022 @03:23AM (#32284989)
Putting both under the same term is meaningless.

Reference counting and Garbage Collection have very clear difference: when the referenced objects are destroyed (not deallocated). In RC it happens when the count reaches zero. In GC it happens some time later. That difference is crucial for having or not having deterministic performance in your program.

Re:Reference count, don't garbage collect by brabel on Saturday July 30, 2022 @04:08AM (#32285159)
Is the Pony language's GC a GC then? It runs at determinate times, namely when a behaviour (an actors' receive function, basically) finishes running... and because actors cannot share mutable state, and immutable values with more than one owner can be handled easily by a simple common parent actor, each actor's GC is completely independent of each other.

Things are rarely as clear cut as we would want to believe.

Re:Reference count, don't garbage collect by viktorcode on Saturday July 30, 2022 @01:14PM (#32288449)
> Is the Pony language's GC a GC then? It runs at determinate times, namely when a behaviour (an actors' receive function, basically) finishes running...

It is. It might run when a behaviour finishes running, according to their docs.

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.

Re:Reference count, don't garbage collect by pjmlp on Saturday July 30, 2022 @04:33AM (#32285239)