Hacker News new | ask | show | jobs
by kibwen 55 days ago
> it is better having automated resource management

Rust's ownership system is automated resource management. What you're asking for is dynamic lifetime determination, which Rust provides via types that opt out of the hierarchical single-ownership paradigm.

1 comments

Nope, because it has plenty of manual hand holding to keep the compiler happy.
Manual memory management requires the programmer to insert calls to free at specific points in the program. That's manual static lifetime determination. A traditional garbage collector uses runtime analysis to determine when it's safe to call free. That's automatic dynamic lifetime determination. What Rust does is automatic static lifetime determination. Designing your data structures such that they're acyclic is not what anyone means when they say "manual memory management".
Rust requires the programmer to manually design data structures and code algorithms in a way that doesn't trigger borrower checker compile errors.

There is nothing automatic out of it.

Write Rust code, compile error if done incorrectly, manually fix the data structure or algorithm root cause, loop.