| ▲ | ceteia 3 hours ago | ||||||||||||||||
Does Rust really require reference counting? I thought Rust programs only used reference counting when types like Rc and Arc are used. Swift seems to require reference counting significantly more than Rust. | |||||||||||||||||
| ▲ | brabel 3 hours ago | parent [-] | ||||||||||||||||
Op saying Rust has a kind of GC is absurd. Rust keeps track of the lifetime of variables and drops them at the end of their lifecycle. If you really want to call that a GC you should at least make a huge distinction that it works at compile time: the generated code will have drop calls inserted without any overhead at runtime. But no one calls that a GC. You see OP is trying to murk the waters when they claim C has a runtime. While there is a tiny amount of truth to that, in the sense that there’s some code you don’t write present at runtime, if that’s how you define runtime the term loses all meaning since even Assemblers insert code you don’t have to write yourself, like keeping track of offsets and so on. Languages like Java and D have a runtime that include lots of things you don’t call yourself, like GC obviously, but also many stdlib functions that are needed and you can’t remove because it may be used internally. That’s a huge difference from inserting some code like Rust and C do. To be fair, D does let you remove the runtime or even replace it. But it’s not easy by any means. | |||||||||||||||||
| |||||||||||||||||