Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is a very common question, and there's two camps:

1. Learn C, then learn some C++. You won't appreciate Rust until you've felt the pain that it solves.

2. Learn Rust. Why bother going through all that trouble on your own when you can have the compiler help guide you.

and a third position:

3. Rust is still new enough that you'll find way more information with C, so you should just learn that even if Rust is better in a vacuum. Learning is easier with copious help and tutorials.

I personally fall in camp 2, and sometimes 3.



Thanks for the reply. I'm leaning towards Rust. I'm required to learn C for university next year (I do physics) so I'm going to have to go through the pain anyway. There's also the quwation of usage in physics circles.

It'll probably come down to the material I'm trying to learn each with. The Rust book looks very good, finding anything decent and modernish for C has been a nightmare.


This is a nice summary! FWIW I'm more likely 1, as I've seen many people coming from dynamic languages being frustrated about the "Rust way". Not only the ownership model, but also compiling, optimization, etc.

3 is certainly a problem, but personally I found enough materials to learn Rust even for now. However more "friendly" resources would be definitely welcome.


While I'm new to rust, and have just been dabbling in C -- as another comment mentions here: you really have to deal with the borrowing in C as well (and the compiling/optimization). If you don't deal with in C (without any real language support) -- you'll get bugs. If you're very lucky, and made a great effort in turning on warnings[1] -- you'll be aware of those bugs. Most likely you won't.

[1] See eg: https://github.com/incrediblesound/Graph-Reply/commit/929e57... for a little bit about C and warnings.


> but also compiling, optimization, etc.

These are going to be the same in C anyway so I wouldn't decide whether to learn Rust or C based on that.


RE: 1) :

    Smart people learn from their mistakes. But the real sharp ones learn from the mistakes of others.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: