3 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 1mo 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 1mo 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 1mo 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 1mo agoNo, I would consider refcounting as variants of GC.
- ghusbands 1mo 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 1mo agoGC specifically means you leave unreferenced mem on the heap until it gets collected in one big sweep later.
- ghusbands 24d 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 1mo agoif refcounting is gc, then c++ is a garbage collected language. It has std::shared_ptr
- frollogaston 1mo 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 1mo agoNo E.g. in Swift the reference counting is automatic a d implicit In C++ it is manual and explicit
- frollogaston 1mo 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 1mo agoGood point, I like your formulation