4 ms·
> By deciding where to scope the variable with the destructor/drop function, you've already made a manual decision about memory management. That's not really w
by kortex 4y ago
> By deciding where to scope the variable with the destructor/drop function, you've already made a manual decision about memory management.
That's not really what's meant by manual memory management. MMM almost always means things like malloc/free, arenas, buffers with pointers, etc. I would not call stack allocation "manual", and IMO Rust's system is closer to stack allocation than it is to either manual or automatic memory.
In terms of DX, bugs and ergonomics, you only really have two schemes: ones which requre some kind of free() call and thus permit use-after-free bugs (manual) and those that make it impossible (ignoring weakref and friends). Rust is not manual by virtue of no free() instruction. In the same breath, "automatic memory management" is not an exact antonym of manual.