4 ms·
ARC as in atomic reference counting? I mean, Rust literally has an Arc<> type!
by zozbot123 8y ago
ARC as in atomic reference counting? I mean, Rust literally has an Arc<> type!
- lmm 8y ago> ARC as in atomic reference counting? Automatic, I think, but yes. > I mean, Rust literally has an Arc<> type! Yes, but idiomatic Rust makes very limited use of it; if you do use an Arc in Rust you have visibility and control over when you unreference it. Whereas in idiomatic Swift you're doing unmanaged dereferences all over the place. I mean, of course it's possible to implement garbage collection in your non-GC language. The difference between a GCed language and a non-GCed language is whether GC is implicit and pervasive, or explicit and manually controlled.
- zozbot123 8y ago> Yes, but idiomatic Rust makes very limited use of it ... This is hardly a positive for Swift; Rust still collects its garbage as much as Swift does; it just does so more efficiently by making use of compile-time lifetime analysis (RAII-like), in addition to the RC technique that Swift uses.
- lmm 8y agoYou were the one who was claiming "it's really not different from Rust from that POV". What you dismiss as "it just does so more efficiently" is the entirety of the difference between GC and non-GC languages; Swift is a GC language with everything that entails, and Rust is not.
- steveklabnik 8y agoSwift’s Arc is automatic reference counting. It’s implemented via atomic reference counting, as far as I know. Rust’s Arc and Rc types are never applied automatically.