|
|
|
|
|
by kerkeslager
807 days ago
|
|
I suspect if you're looking at C++ as a viable language for the problems you're solving, you're solving quite different problems from me, so take this with a grain of salt. What I wanted from Rust was basically a strongly-typed C and more modern tooling. I'm open to more checking than that, depending on what cost it has. What I'm getting is strong typing and more modern tooling--cargo, for example, is excellent. But the borrow checker is extremely invasive, and `unsafe` doesn't actually make it less invasive. There are a number of cases where I still haven't figured out how to get the compiler to not complain about the lack of a `.clone()`. Borrow semantics are... pretty good, as it's basically enforcing a pattern I use frequently anyway, but the exceptions to that pattern are critical and working around the borrow checker causes more problems than it solves. It's possible I just don't know how to make "the Rust way" more workable, but if that's the case I am having a hard time finding how what "the Rust way" is for the things I'm trying to do. That said, I can see how Rust is a great tool for what it was originally intended for (writing a browser). That's just not what I'm doing. |
|
Also, unsafe is not meant to ease the borrow checker pains, that's like using void* everywhere in C because you don't know how to type a function pointer. Unsafe is meant for places where rust simply doesn't know better, like reading memory mapped registers.