6 ms·
Seems like RUST needs work to become easier to learn. Hard for a business to take a risk on using it (outside of a use case absolutely needing a memory safe lan
by godzillabrennus 3y ago
Seems like RUST needs work to become easier to learn. Hard for a business to take a risk on using it (outside of a use case absolutely needing a memory safe language) if the talent pool is shallow.
- wredue 3y agoHonestly. Rust is not all that “difficult”. There’s just SO MUCH that you MUST know to be effective. You need to know all of the rustisms. Plus you need to have a general knowledge of memory. You need to understand how memory is being abstracted and how to work within those constraints so as not to be slow. You need to know all of the monads, what they mean, why each exists, what the nuance is, and why you might use one over another in a specific situation. It’s not difficult so much as it just takes so much time and challenging-yourself practice to try to memorize everything. A “being effective at rust” book would probably dwarf a “being effective at C++” book in pages assuming similar prose. And we all know how much of a beast C++ is.
- spoiler 3y ago> A “being effective at rust” book would probably dwarf a “being effective at C++” book in pages assuming similar prose. And we all know how much of a beast C++ is. I've written C++ for close to a decade before switching to Rust, and this is categorically untrue. > Plus you need to have a general knowledge of memory. You need to understand how memory is being abstracted and how to work within those constraints so as not to be slow. If anything, this is more true so of C++. > You need to know all of the monads, what they mean, why each exists, what the nuance is, and why you might use one over another in a specific situation You can use a lot of stuff before needing to know their full history. You don't need to know the history behind 0, null, pointer, numbers and addresses before, how hardware works, etc to use Option, for example. You also don't need to know the (inconsistent and arcane) history of errno and magic numbers to use Result. Etc, etc. This vastly over-exaggerates Rust's complexity. Yes, it borrows concepts from functional programming, but a lot of these concepts are simpler than stuff you deal with in imperative programming. I think the issues here is that people don't tend to like to change their way of thinking, even if it's for the better. Also, Rust has ample in common with imperative/traditional language, so it's not a huge leap into some alien mental model, as you make it sound. Further, C++ makes you think way more than Rust; in Rust the compiler does a lot of the thinking for you. Not to mention, the type system is easiest to reason about than C++'s old (and mentally inefficient) template system.
- withoutboats3 3y ago"Dwarf"? "Dwarf"?! I may be biased (because I am very effective at Rust and terrible at C++) but I can't believe this seems probable. std::optional, move semantics, boost, template templates, SFINAE(!!) C++ has all the expressivity of Rust and more, with far less regulation to assist the programmer in using it effectively.
- PH95VuimJjqBqy 3y agoyou don't have to know _any_ of what you just listed in order to be effective with C++. the closest thing to required would be move semantics.
- tracker1 3y agoDepends on what you're trying to do. The same can be said of Rust. You can write massive web services serializing days from RDBMS databases quite a bit easier in Rust than with C++ as an example.
- PH95VuimJjqBqy 3y ago> Depends on what you're trying to do. No it doesn't. people were effective with C++ before std::optional existed, before compiler assisted move semantics existed, and SFINAE is not something anyone has ever needed to understand in order to use something like the STL or any other template based library, such as Boost. You don't know what you're talking about, this isn't up for debate.
- thfuran 3y ago>It’s not difficult so much as it just takes so much time and challenging-yourself What's the difference?
- adamnemecek 3y agoLearning Rust to the point of being productive is 100x easier than C or C++. It's not even funny.
- josephg 3y agoThat hasn’t been my experience with it. I found rust significantly harder to learn than C; and this is after I already knew C. (At least - learn rust to the point of feeling productive, and like I wasn’t fighting the borrow checker constantly). Arguably becoming an expert in C means you need to understand all the nuances of undefined behaviour. And that’s a much harder process. But it can happen slowly. Rust preloads all the pain. You essentially can’t write rust at all until you understand rust references, lifetimes (implicit and explicit) and the borrowchecker. The payoff is huge, but I found climbing that mountain to be no joke.
- adrianN 3y agoGiven the number of CVEs that can be directly attributed to C and C++ you only need to be half-joking to argue that approximately nobody has managed to learn the languages sufficiently to write production code in them.
- josephg 3y agoAs uncomfortable as this is to say, the existence of latent security vulnerabilities doesn’t seem to stop people from shipping a lot of apparently working code in C and C++. And I don’t think a lot of those CVEs come from people misunderstanding the languages. As I understand it they mostly come from honest software bugs. C++ makes it easy for honest mistakes by experts to become security nightmares. This is a controversial opinion - but I think the fault is in C and C++ themselves. Not the programmers who need to work even harder such that they stop ever making mistakes.
- vacuity 3y agoWhich is why some people push for no longer using C and C++ as much as possible. It's just not feasible to expect the average programmer to avoid all the security pitfalls. Of course, whether Rust is the best option isn't a given.
- unclad5968 3y agoI don't care that it's hard to learn. What turns me off rust is that if I ever make a change that requires a lifetime annotation, I now have to go back through all my code potentially adding lifetime annotations to everything it touches. I was making a little toy compiler in rust and basically gave up when I wanted to make a change that would have amount to string -> string_view in c++ because in rust I now need to tell the compiler that the String to my &String is going to outlive the struct. Now I understand why it's good but Id rather just let c++ blow my feet off. Maybe once I nail down all the data structures I'll rewrite it in rust.
- zozbot234 3y agoIsn't that why Rc<> and Arc<> exist in Rust? So that you can deal with situations where you don't know the object lifecycle at compile time?
- miniupuchaty 3y agoIf you're fine with dropping safety you can just make a wrapper around a raw pointer. I wouldn't do it in public library but if it's fine for your cpp code then it's fine for your rust code. You can always drop to the "blow my feet off" level.
- merb 3y agoThe last few versions made a lot of the lifetimes elided so you can drop them.
- PartiallyTyped 3y agoRust is very easy to learn. Just read what the compiler says. The compiler is there to help you, it has a holistic view of what's going on, and it knows what it needs for your code to be fixed.
- tracker1 3y agoIt's not that hard for relatively easy work... I've written a few basic web services, as an example, using a few of the more popular web frameworks for Rust, it hasn't been much harder than say C# or Node. Now some of the more complex things, have been far more complex to do by hand.. Shared data, channels, Arc, etc. Those have been a bit more cumbersome and still not sure I've done the right thing at times.