logoalt Hacker News

gwbas1c • yesterday at 7:50 PM • 0 replies • view on HN

In practice, "garbage collected" means a tracing garbage collector, as opposed to other automatic memory management systems. IE, When Objective C added automatic reference counting, they didn't call it "garbage collection" because you still had to manage cyclic loops; and because "garbage collection" was a deprecated option for an experimental tracing GC. They called it "automatic reference counting" because, in practice, garbage collection means a tracing garbage collector. (The best reference I can find on this is https://stackoverflow.com/a/6385904)

I also would never call Rust a garbage collected language. It's more like a language where the compiler enforces memory safety. The difference is that it's on the programmer (or AI) to write correct code; and correct code includes implicit deallocations; but you still need to manage cyclic loops in RC or ARC.