3 ms·
I often encounter people that want to learn a programming language and ask if they should pick Rust as their first language. My answer is universally: NO. Lea
by petcat 1y ago
I often encounter people that want to learn a programming language and ask if they should pick Rust as their first language. My answer is universally: NO.
Learning a first programming language is hard. And Rust will only make it harder since all you're going to do is debug compiler errors all day and never even see your program actually run until it's "perfect". This will be incredibly frustrating and you'll give up.
I always tell people to start with Python, JavaScript, or Lua. You can make something fun and interesting for yourself, like a game, and get immediate feedback and you can iterate quickly.
- tracker1 1y agoI would suggest Python or Lua before JS if you want to learn formally, such as following a book/series/class. JS (and TS) just have so much flexibility and many functionalities have been enhanced over the years that depend on the runtime context and build tooling in some cases. Don't get me wrong, I love JS/TS since before the "Good Parts" book ever came out. The only advantage it has as a first language is you can start tinkering directly in the browser... Which is something I use to this day... the debug console in the browser, I can exercise a generated API client before the UI features are flushed out. If you want to learn with the intent of "I want to build $THING." then JS/TS is probably a great language to start with... you will probably want to read something like a for dummies book to start, then bootstrap with a coding ai... and tinker until it works. Note: don't do this for anything security critical when starting out.
- tucnak 1y agoTo be fair, Rust is genuinely just as _hard_ in 10th language capacity.
- stouset 1y agoI really don’t think so, but it probably depends on which languages you’ve used in your life. I’ve spent most of my professional time in C, Ruby, and a decent amount of time dabbling around in functional languages. All of the core bits of Rust from this post more or less clicked immediately for me. The other features are there, but they’re typically not something you need to internalize to comprehend Rust as a whole. The biggest hurdle—as for most people—was learning what the borrow checker is really trying to teach you about the structure of your programs and internalizing those lessons. But having some experience with RAII and good practices around manual pointer ownership in C helped pave a pathway toward understanding those concepts.
- metaltyphoon 1y agoNah not really. If you are in C/C++ land you know exactly what problem Rust solves. If you only even known GC languages then yeah it will be a up battle hill.
- baq 1y agoI agree. Rust wouldn't be a bad language if humans were able to take it in all at once. The problem is, nobody learns like that and Rust is very hard to iterate on if you don't know a lot of the key concepts. The problem with this is you'll necessarily have to unlearn something or be frustrated when you achieve some level of proficiency in other languages since it still requires all those concepts which don't exist anywhere else.
- zozbot234 1y agoThere is an easy subset of Rust, namely the "pure functional" subset that doesn't use reference types at all and just passes everything by value. The use of & ("shared") references is only marginally harder. All of these features can be introduced step-by-step, together with basic notions that are not exclusive to any programming language. I'm aware that this is not how Rust is generally taught, but it's worthwhile to attempt such an approach.
- ChadNauseam 1y agoNot my experience. We have an ML engineer at work that has only worked with python. He wanted to contribute to our rust codebase so I spent about an hour going over the basics of rust with him, and answered questions as they came up, and he was able to get up and running very quickly. He quickly became quite productive in our rust codebase. And theoretically, I'm not sure it's that very fun to run your game, have it crash because you passed a string to a function that expected an integer, stare at a backtrace, see where that variable came from, go up the call stack a few levels, and then realize "oh, i forgot to parse that string after the user typed it in". I'd rather get a compile error that underlines the problematic code and says "this is a string, but the function expected an integer". It may be debugging compiler errors all day, but the alternative is debugging runtime errors all week.
- deleted 1y ago[deleted]
- tialaramex 1y agoI'm not convinced. I want to see Rust as First Language attempted by somebody good. The staff who taught me the Standard ML of New Jersey are retired, and the current programme head is a friend who disagrees with me strongly about how this entire discipline should be approached, but in principle I feel it ought to be interesting & might be extremely productive for the cohort. I think worst case it's a "sink or swim" course where a large fraction of the cohort wash out and that's bad for numbers (which will annoy bean counter but for a prestige university might actually be OK medium term) and best case the wash out rates are no different but the good students are receiving a lot more value than for today's First Language which is (at the university I'm thinking of) Python. I think the move assignment semantic and the use of "const" to mean constant are examples of things where Rust is significantly penalized by having older languages teach their insane choices as just "How it is" so that then later a Rust course needs to have students un-learn this stuff when it would be easier to begin there.
- janameow 1y agoIt has been attempted! I've taught if to over 400 beginners now and cannot overstate how it's not just possible but actually works pretty damn well. And students instantly have a background from which they can learn other languages too.
- recursivecaveat 1y agoIn general I recommend people stay away from static typing for a first language. I'm a static typing booster, but for beginners it is unnecessarily confusing. Compiler errors are by nature often counterfactual: "compiler couldn't prove that this wasn't none" or "once you pass through this generic method it's no longer known that your list of Animal only contains members of Dog" is usually more confusing and less tractable than a concrete test case that craps out your program. Then you can start poking away with prints at the stacktrace. If you step through every single line of your execution carefully and inspect all the data, you're virtually certain to unstick yourself. I can't say the same if you get some gobbledygook from the compiler.
- janameow 1y agoI'm the author of the quote at the top of this blog post. I've at this point taught rust as a first language to over 400 people and am very amused by the claims in this thread and it's comments. After a few years of doing this I'm not just convinced it's possible, but have seen a lot of evidence of it working pretty well.