16 ms·
> It promises a secure memory handling enabled by its principle of zero-cost abstraction. I thought memory safety comes from enforcing proper memory usage thro
by shmerl 8y ago
> It promises a secure memory handling enabled by its principle of zero-cost abstraction.
I thought memory safety comes from enforcing proper memory usage through ownership rules (borrow checker), not through zero cost abstraction, which simply indicates that high level language features are translated into efficient system level code.
- monocasa 8y agoWell, the borrow checker is a zero cost abstraction. It's enforced at compile time.
- laughinghan 8y agoI think because said enforcement is done at compile-time (by the borrow checker) and not at runtime, it is considered a zero-cost abstraction by the creators of Rust.
- tybit 8y agoYou are correct, the sentence implies that it is the zero cost abstractions that makes it possible which is not right. The zero cost abstractions part is a nice benefit, but unrelated to ensuring safety.