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

The difference is you need to explicitly handle cases that would cause runtime errors where you have to use .unwrap() or match selectors, which makes it safer in general. Since the values are wrapped in Result or Option enums. Code that doesn’t create these types isn’t possible to have runtime errors which reduces cognitive burden when coding.

And yes you can write non-idiomatic Rust that lets you leak memory but it doesn’t happen by accident like in C/C++.



> Code that doesn’t create these types isn’t possible to have runtime errors

Rust code can still panic and unwind at runtime. There's some ongoing work on supporting guaranteed-not-to-panic code for very specific uses (similar for guaranteed-not-to-leak, which is a related problem), but it's a long way off and will not be applicable to anything that must interact with the system in any way.




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

Search: