4 ms·
In rust though, you dont have to handle errors all the time. You can just unwrap them, and crash when there's an error.
by UK-AL 7y ago
In rust though, you dont have to handle errors all the time. You can just unwrap them, and crash when there's an error.
- bmurphy1976 7y agoIt's not just that though, GC is also a big part of the equation. I stopped manually managing memory 20 years ago. I'm not interested in going back to that. I get that certain aspects of Rust make that easier (and certainly safer) but I'm not working in a domain where the performance gains of ditching GC matter.
- jzoch 7y agoYou are hardly managing memory in rust...reference allocation is practically garbage collection and feels as such in rust.
- 0815test 7y agoReference allocation _is_ essentially equivalent to garbage collection, the one thing it doesn't deal with correctly is reference cycles. Which are inherently unlikely if you spend the time and effort to organize your code properly. (The Rust community is also working on cycle-aware reference collection, e.g. https://github.com/lopopolo/ferrocarril/blob/master/cactusref/README.md https://github.com/lopopolo/ferrocarril/blob/master/cactusre... but this will always come with some drawbacks.)
- mplanchard 7y agoI’ve written quite a bit of Rust, including an implementation of a collision-resistant UID algorithm and a static website generator. I’ve also written quite a few “git-er-done” scripts in the language as part of other projects (for example, a script to randomly generate linked data and write it to a couple of CSVs). At no point so far have I had to manually manage memory. As others have noted, this is what the borrow checker enables: you write code as though it were in a GC language, and the compiler handles inserting the allocations and deallocations. Of course, you can manually manage memory in Rust, but it is almost never necessary for high level applications. I’m not at all claiming it’s the best tool for every job (although I do think it’s great), just clarifying the point about memory management.