Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The author really doesn't want to do manual memory management. The table is there to summarize things discussed, but he never says he wants to do manual memory management. I just went back and checked. If you do find something that indicates that, I'd appreciate you pointing it out to me, because idgi


> The table is there to summarize things discussed, but he never says he wants to do manual memory management.

  But it requires me to manage memory and lifetimes, which I think is something the compiler should do for me.
The author wants the compiler to do memory management? How does Rust achieve this?


The compiler works with you to ensure that you’re not misusing memory. If you make a mistake, it will let you know.

You’re not often manually managing memory in the same sense as other low-level languages. You’re not invoking malloc and free directly. Thanks to ownership, when you do allocate, Rust will call free for you.

It’s somewhere in between fully manual and fully automatic. It can feel more like one or the other based on what you’re doing, but most of the time, in average, it feels like automatic.


It is better to think of Rust having explicit memory management, rather than manual memory management. C/C++ has manual memory management: the burden is on you to do it correctly. If you fuck up, your program will have bugs. Rust requires that your code be explicit about memory issues, but the compiler works with you to achieve that. if your code compiles it is correct; if it doesn't compile, the error points out what needs to be fixed. When I write Rust it rarely feels like I am taking on that burden myself.


I read the article twice, but I could also just be wrong; it's not that big a deal.


No problem, get some sleep in that case :D




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: