3 ms·
I've written a ton of software, both backend and embedded-like software in C++. What are people writing that requires such fancy/extensive usage of the borrow
by dinobones 2y ago
I've written a ton of software, both backend and embedded-like software in C++.
What are people writing that requires such fancy/extensive usage of the borrow checker?
I can't even remember the last time I had to use a shared_ptr... unique_ptr and other general RAII practices have been more than enough for our codebase.
- loeg 2y agoI think OP is likely overusing references. The vast majority of code doesn't need to deal with explicit lifetimes.
- andybak 2y agoOP sounds fairly smart and my first thought is "if OP is struggling then Rust probably isn't for me". Who is Rust for?
- kstrauser 2y agoIn some ways, people who aren’t heavily invested in other languages to the point that they think in them. Neophytes know less, but they also have fewer things to unlearn.
- loeg 2y agoI don't think it's useful to think there is some single spectrum of intelligence that makes one more or less suited to using Rust. Rust is for anyone who finds it useful.
- Const-me 2y ago> I've written a ton of software, both backend and embedded-like software in C++ Me too. > What are people writing that requires such fancy/extensive usage of the borrow checker? The simplest example I can imagine is this: https://en.wikipedia.org/wiki/Matrix_multiplication https://en.wikipedia.org/wiki/Matrix_multiplication When your matrices are large and you want it to run fast, you want to parallelize. Good algorithms (which don’t bottleneck on memory bandwidth) need multiple CPU cores to concurrently store different elements of the same output matrix. Moreover, the elements computed by different cores are not continuous slices, they are rectangular blocks. Such algorithm is not representable in safe rust.