Re:Compile time evaluation in Nim, Zig, Rust and C++
by coliveira on Tuesday April 26, 2022 @03:40PM
(#31172197)
ARC is not new, it was used by Apple in their languages for at least 10 years now.
[ Parent
| on HN ]
Re:Compile time evaluation in Nim, Zig, Rust and C++
by ______-_-______ on Tuesday April 26, 2022 @03:52PM
(#31172329)
Obviously parent is not claiming that Nim invented the concept of reference counting. They're saying that it's a recent addition to Nim, and Nim's other memory management strategies have been part of the compiler for longer.
Re:Compile time evaluation in Nim, Zig, Rust and C++
by elcritch on Tuesday April 26, 2022 @11:22PM
(#31175951)
That and that Nim's ARC system extends the concept a bit further to include move semantics and limited ownership rules. Nim had a traditional RC garbage collector before, but ARC is case where "the whole is greater than the sum of parts".
Swift and Obj-C's ARC system relies on atomics and their associated issues (explained well here: https://news.ycombinator.com/item?id=15046481).
Nim's ARC system relies on ownership rules that require a single thread to "own" any ARC-managed memory which removes the need for locks or atomics in the reference counts. That eliminates the non-determinism of locks & atomics when doing the RC accounting, overall improving latency and performance. Move semantics increase performance and enables "giving" ownership of ARC-managed memory to another thread.