37 ms·
> moving from a GC’d language Rust was never actually a GC’d language. It had a smart pointer called Gc (and before that @), but that was only ever implemented
by masklinn 3y ago
> moving from a GC’d language
Rust was never actually a GC’d language. It had a smart pointer called Gc (and before that @), but that was only ever implemented as refcounting (according to the changelogs some preliminary work had been done towards a precise GC but AFAIK there was no followup).
This is in large part why it was dropped: it was technically redundant with Arc, and could give users the wrong impression, and could always be added back later if that made sense.
- pjmlp 3y agoTechnically from CS point of view, refcounting is a GC implementation algorithm.
- masklinn 3y agoI fail to see what that has to do with anything, unless you’re asserting that current rust is GC’d on the back of arc existing.
- pjmlp 3y agoIt has to do everything with the wording on your comment that kind of makes the usual lay man distinction between GC and refcounting, nothing to do with Arc, as using it is manual work anyway.
- Zambyte 3y agoThe point of a garbage connector is to simulate infinite memory[0], which is the point of Arc. So current Rust has GC :) [0] https://octodon.social/@cwebber/110815313802832972 https://octodon.social/@cwebber/110815313802832972
- bmacho 3y agoRust as a language is not GC'd, but has a refcounted (that is, GC'd) pointer type if you want/need it.
- ryukoposting 3y agoYes, but does that make circa-2013 Rust a "garbage collected language?" It seems to me that when we talk about GC'ed languages, we're talking about languages where the heap is managed implicitly. If I understand it right, @ is explicitly invoked by the user, but the implementation is embedded within the language. With Arc/Rc, there are Deref/Drop implementations somewhere in the stdlib that do the reference counting.
- pornel 3y agoThe original design by Graydon envisioned a real GC, but one per task/actor instead of global, with limited message passing between threads. http://venge.net/graydon/talks/intro-talk-2.pdf http://venge.net/graydon/talks/intro-talk-2.pdf
- flohofwoe 3y agoRefcounting is also just (dumb and slow) garbage collection though.
- masklinn 3y agoThe main point is that rust was never a ref counted langage, it had a purportedly GC’d opt-in pointer type. And while refcounting has lower throughput than more advanced forms of garbage collection, it has a much higher reactivity / lower memory overhead, and it integrates much better with other methods of resource management.