4 ms·
Let's say you're a fresh grad and looking at options for you future dev career: Option 1. Spend the next 5 years learning the ins and outs of C++, where it can
by alfiedotwtf 9y ago
Let's say you're a fresh grad and looking at options for you future dev career:
Option 1. Spend the next 5 years learning the ins and outs of C++, where it can bite you, where it can go wrong, all the intricate edge cases, etc... and you'll come out a better C++ programmer. Hopefully after 5 years of hard concentration, you may be able to write safe code (I still haven't met a C++ programmer that hasn't been burned by segfaults in production).
Option 2. Spend a single month learning Rust. Play with it for another month or even two just to be sure. Hopefully after the 3rd month, they'll be 100% certain that their code won't break because of errors that are above their pay grade.
I've done programming for over 12 years. x86 assembly and C for the earlier years. Then I realised that higher level languages gave me the power to code confidently without causing the errors that I was constantly seeing without explanation.
After many years of HLL I wanted to go back down to the metal... after everything that I knew, "C or C++, not even once".
Rust gives me the confidence to "compile once, run safe everywhere".
- ccommsxx 9y ago>> Spend the next 5 years learning the ins and outs of C++, [..,] Spend a single month learning Rust. Play with it for another month or even two just to be sure. Hopefully after the 3rd month, they'll be 100% certain that their code won't break [...] Rust gives me the confidence to "compile once, run safe everywhere". See, this is exactly the fallacy that I am criticizing. I think the belief that "C++ is too hard to learn but one could become a good systems programmer in rust in a few months" is - frankly - misguided. I think that in order to become a good systems programmer in rust, you _will_ have to know all of your systems basics (i.e. you should already be able to code in C for starters) and then some more. But sadly this seems to be the spin that their marketing is pushing also. Personally, I found practical rust (that interfaces with actual system libraries - think openssl) to be more or less on par with good C++11 with RAII memory and ressource management in terms of practical memory safety. Having somebody writing rust code without a basic understanding of things like ressource management and threading is just as bad as having them writing "unsafe" C(++) code. I hope I'm not feeding the trolls here.
- alfiedotwtf 9y agoAnother scenario: Option 1. Spends 5 years learning the ins and outs of systems programming, whilst using C++. Still writes unsafe code. Option 2. Spends 5 years learning the ins and outs of systems programming, whilst using Rust. Zero unsafe code has ever been written.
- ccommsxx 9y agoAgain, the assertion that all code written in rust is automatically "safe" (let alone correct) is false unless you say what precisely you mean with "safe" in very specific terms. While there are some ways in which rust is "safe" while c-family languages are not, these cases are _subtle_ and you _will_ have to understand modern C++ first to see what they are. But yes, rust could turn out to become a new widely accepted standard for systems programming some day and depending on whether you believe that or not, it might make sense to "invest" your time into it.
- alfiedotwtf 9y agoI'm talking safe as in Rust's memory safety guarantees.
- ccommsxx 9y agoAs far as I understand, there is no accepted formal specification or even single source of truth for what the rust community thinks are the "rust memory safety guarantees". Only a large number of people that have completely convinced each other that "it's better than C++" with little proof and without even clearly defining their own semantics. Please correct me if I'm wrong here (a blog post does not qualify as a specification). Relevant: https://github.com/rust-lang/rfcs/issues/1447 https://github.com/rust-lang/rfcs/issues/1447
- alfiedotwtf 9y agoTrolling you? Go fuck yourself
- daemin 9y agoThat assumes there will be no errors in the Rust compiler or runtime environment to deal with. If there are then those would definitely be above their pay grade.
- alfiedotwtf 9y agoI'd take a bug within LLVM over my own any day
- steveklabnik 9y agoRust has basically the same amount of runtime as C; I'd say "standard libraries" here instead, personally.