4 ms·
As a C++ dev that is very Rust enthusiastic. Rust is quite easy to learn if you have a decent grasp of C++. The biggest thing you need to unlearn is the parano
by carlmr 4y ago
As a C++ dev that is very Rust enthusiastic. Rust is quite easy to learn if you have a decent grasp of C++.
The biggest thing you need to unlearn is the paranoia.
- pclmulqdq 4y agoAnd that most things you used to do with pointers (linked lists, graphs, etc.) need to be done with something else.
- pkolaczk 4y agoTypically those things would be enclosed in libraries providing safe and convenient APIs. Sometimes you might need to use a bit of Rc<RefCell> here and there. At worst, you are not any worse than in C++: use unsafe.
- pclmulqdq 4y agoIf I had $1 for every time someone told me that Rust had a "safe and convenient" API to do something that I wanted to do which didn't actually do the thing correctly or conveniently, I would have a lot of money. This line really needs to be dropped from the Rust sales pitch. If I did it myself in another language which also has a ton of libraries (eg C++, Java, Go, etc.), there is no reason why I would want to reach for a library for that piece of code in Rust. There's usually a good reason why I didn't use a library.
- adgjlsfhk1 4y agoin c++ often the reason is just that c++ dependency management sucks
- pclmulqdq 4y agoI actually don't find that to be the case, since most of the things you need are in one of the mega-libraries from Google or Facebook and the alternatives are often easy-to-find github repos. The convenience of npm and cargo is offset by the fact that the documentation for most libraries is nonexistent, the creators inject their idiosyncrasies, and lots of library code has not actually been tested very well. Not to mention that the dependencies can change for the worse underneath you, and if you want the old features you had, you have to give up all new developments.
- ReflectedImage 4y agoYou are not suppose to spamming Rc<RefCell> :p It's called Single Ownership.
- pjmlp 4y agoRegarding paranoia, it will go well if the C++ developer is coming from "security matters", instead of "turn performance to 11" mindset.
- jokethrowaway 4y agoThat paranoia is healthy, it gets you thinking about memory and efficiency. You can be inefficient with Rust as well. The good thing is that you're less likely to get a null pointer or other silly mistakes / security incidents waiting to happen.