9 ms·
I wouldn't consider Rust a manual memory environment. There are ways to do that at edges if needed, but it is otherwise very much automatic which is kind of th
by kev009 28d ago
I wouldn't consider Rust a manual memory environment. There are ways to do that at edges if needed, but it is otherwise very much automatic which is kind of the whole point of its design.
- frollogaston 28d agoWhat most people mean when they say this is GC vs no GC. Rust is the latter. You have to care about ownership unless you're wrapping in Rc/Arc.
- TonyStr 28d agoI agree with you, but I just want to point out that there are other seamless solutions to memory management like refcounting, used by for example GDscript (Swift? Perl?). You definitely wouldn't consider this manual memory management
- yxhuvud 28d agoNo, I would consider refcounting as variants of GC.
- ghusbands 27d agoRefcounting is indeed a form of GC (and the languages that want to handle cycles then need an extra form of GC on top of it).
- frollogaston 27d agoGC specifically means you leave unreferenced mem on the heap until it gets collected in one big sweep later.
- ghusbands 14d agoYou're referring specifically to tracing garbage collection. When a reference count reaches zero, that garbage is collected, often recursively. Among programming language designers, ARC is considered a GC strategy. https://en.wikipedia.org/wiki/Garbage_collection_(computer_science) https://en.wikipedia.org/wiki/Garbage_collection_(computer_s... https://users.rust-lang.org/t/reference-counting-garbage-collection-and-rust/107728/24 https://users.rust-lang.org/t/reference-counting-garbage-col...
- vrighter 27d agoif refcounting is gc, then c++ is a garbage collected language. It has std::shared_ptr
- frollogaston 27d agoRefcounting isn't GC, but also C++ isn't a refcounted language. You could spam shared_ptr everywhere, but it's not designed for that and probably wouldn't be performant. And because of that, realistically all your libs take raw pointers, so you still have to unwrap your shared_ptrs then be back to managing ownership. Swift has refcounting built into the language and assumed everywhere. You could always use raw refs in Swift, but that's not the norm.
- worik 27d agoNo E.g. in Swift the reference counting is automatic a d implicit In C++ it is manual and explicit
- frollogaston 27d agoI wouldn't consider Swift manually managed, but also not GC. And not being GC has some practical implications like needing to break cycles yourself, so you need to at least be aware of ownership a little. It's like a manual transmission vs automated manual vs true automatic, AMT removes most of the work but still cannot be treated like full auto.
- TonyStr 27d agoGood point, I like your formulation