5 ms·
As someone with no Rust experience... a) access to invalid memory regions, b) dangling pointers and attempts to free already freed memory, c) memory leaks and,
by ced 10y ago
As someone with no Rust experience...
a) access to invalid memory regions, b) dangling pointers and attempts to free already freed memory, c) memory leaks
and, d) race conditions.
The first three benefits also come with essentially any GC'ed language. d) is interesting. What are the costs that come with such a guarantee? Presumably it prohibits certain kinds of parallelism? Are the ownership/borrowing mechanics interesting programming tools, or are they a hindrance?
People talk a lot about static typing, and I can see the benefits for critical/user-facing applications, but not for numerical code. The nightmare with numerical code is finding out that I forgot a minus sign somewhere, and that it invalidates my last 6 months of published results.
- eridius 10y ago> Presumably it prohibits certain kinds of parallelism? Actually it enables parallelism you couldn't do before, because now you're confident the compiler will prove that what you're doing is safe.
- steveklabnik 10y ago> Are the ownership/borrowing mechanics interesting programming tools, or are they a hindrance? Like any sort of static analysis, some see them as a tool, some see them as a hindrance ;) > also come with essentially any GC'ed language. Ownership and borrowing can extend to arbitrary resources, not just memory. Also, C and D aren't correct; while Rust helps with memory leaks, it absolutely does not prevent them, and Rust prevents _data races_, a specific form of race condition, but cannot prevent race conditions generally.