I doubt it. Rust's learning curve is much better than C/C++ (assuming your target is "reasonably competent at writing code other people would want to use" and not "can make a linked list").
It's way easier to learn to write correct Rust code than correct C code. Correct as in not leaking memory or reading uninitialized memory or segfaulting, which probably everyone who first started writing C spent time wrestling with and learning how to use Valgrind and so on.
Yes, of course; I'm pretty much of the opinion that it's basically impossible to write correct C code because it's so easy to make mistakes in. However, it is easy to write code that generally works, more so than in Rust, which puts up abstractions designed to prevent every single kind of mistake, some of which you might not even know exist because you've just started learning programming.
Which approach is better? Not sure. But that's a different question.
I don’t know… I’d rather say that learning curve is more of a journey from ‘I can write code’ through ‘I can write code that compiles’, ‘I can write code that works’, ‘I can write code that works well’ to ‘I can write code that works well and is readable’ and certainly the first few steps are much harder in Rust than in C or even C++, so I’d call that a steeper learning curve.
One thing to note is that the claim wasn't "shallower" but "fantastic". A sufficient response to this is that it's "fantastic" because the vertical distance between "can write code that compiles and looks reasonable" to "can write code that is reasonably correct" is small. I doubt you would find many other languages where that area is so small in fact (Idris comes to mind).
I'd also argue though that while the learning curve for rust is initially steeper, it is shallower when you look at the curve up to the point where you want contributors to be. C/C++ has an insanely steep cliff to go from "can write reasonable looking code" to "can write reasonable correct code".
The first argument is in some sense better because it doesn't restrict me to talking about C/C++.
- Rust skips (or almost skips) some of those steps. If you can write code that compiles, you can also write code that works. It forces you to be very specific about your intentions, which isn't possible in language with less-thorough type systems and compile-time checks.
- I agree that the curve is steeper at first, but it's arguably impossible to write code that "works well and is readable" in C/C++ (which is why we have Rust in the first place). That makes the latter part of the learning curve an asymptote.
> Rust skips (or almost skips) some of those steps. If you can write code that compiles, you can also write code that works. It forces you to be very specific about your intentions, which isn't possible in language with less-thorough type systems and compile-time checks.
Forcing new programmers to be specific about intentions they may not even know they are supposed to have doesn't necessarily work.
> I agree that the curve is steeper at first, but it's arguably impossible to write code that "works well and is readable" in C/C++ (which is why we have Rust in the first place). That makes the latter part of the learning curve an asymptote.
I don't agree with your analysis of "works wells and is readable". It's not too to write C code that works well and is readable. Sure, your code might occasionally break–but the point is that it works most of the time. This isn't necessarily a good mindset to have as a software engineer, but with regards to the specific claim that Rust is easier than C: it's not, because it enforces better practices, which is mental overhead and complexity that C doesn't need to deal with.
> Forcing new programmers to be specific about intentions they may not even know they are supposed to have doesn't necessarily work.
Rust is not a good language for new programmers. Neither is C for that matter. You shouldn't start learning Rust before you have solid intuitions of programming concepts like ownership, scope and mutability.
It is also easy to make a program that compiles in C, and somewhat easy to make it work in some case from there. The real tough part is learning all the tooling required to do anything complex reliably in C.
I think it is quite easy to do simple things like opening and closing files reading writing. String manipulation and working with vectors can be similar to python at times..
The ownership concept is a bit harder to grasp, it took me maybe a day to get the initial understanding and a year to really feel comfortable in all situations.
The thing is, now that I understand it it is not only very powerful, but it allows you to think about your code differently: because of the strict ownership rules you tend to be aware at all times of the impact of the code you are looking at in any given moment. Combine this with the strong type system and you really feel in control.
When I moved from python to Rust I probably wouldn’t recommend Rust to beginners. In hindsight I am not so sure about that anymore. It is hard, but it is teaching some concepts every programmer in any language could use and it is incredibly consistent.You rarely find any weird edge cases that are the way the are because of some arbitrary decision. Most language design decisions have been extremely careful considered and you can feel that. This is contrary to many traditional beginner languages, whkch are often filled to the brim with weird edge cases.
The cargo environment is incredible.I wish I had something like this for python
I feel similarly, I'm not sure it would be success, but I think it would have a good chance.
I'm very tempted to try and design a "learn programming via rust" course and then find some guinea pigs (err ... students) to see how it works. If I had infinite free time I definitely would.
I learned programming mostly with processing (https://processing.org/) For beginners the huge benefits would be:
- instant visual feedback: Loops make much more sense when you can see them
- easy to get running (I’d argue rust is the same)
- Limited enough to learn basic concepts and not get overwelmed
The hardes thing about teaching any traditional language is probably explaining why it is mostly a command line/terminal thing without huge efforts.