8 ms·
How to Learn Modern Rust
- becquerel 4y agoIs Rust old enough for there to be a 'modern' Rust?
- treeman79 4y agoIf this was JavaScript, the current modern would be old school by the time I finish writing this sentence.
- nindalf 4y agoNo, that sort of talk isn’t helpful.
- adamdusty 4y agoI think so? Modern c++ (c++11) came 13 years after c++98. Rust has been released for close to or longer than that depending on your definition of released.
- bluejekyll 4y agoRust has improved in a number of significant ways since 1.0, those improvements are things that make it easier to work with in a number of ways. One way to think about this topic is if you found the language too hard in the beginning you may find it easier to work with now. Also, since it was released a lot of patterns have evolved to work around the restrictions the language puts in place, and those are good to learn.
- bobbylarrybobby 4y agoYeah, not really. The only big changes to the language core were non lexical lifetimes, match ergonomics, lifetime elision, auto-deref, and async, although all of these are already so old now that I wouldn't consider them constituents of modern Rust; they're just (unqualified) Rust at this point. Releases tend to bring some minor improvements like functions you wished had always existed or making non-const functions const, but that's pretty much it. Rust is a remarkably stable language.
- duped 4y agoCode that predates the 2018 edition can have some cruft, especially with respect to the module system.
- nicoburns 4y agoArguably it's young enough that all Rust is 'modern' Rust.
- School-Cotton 4y agoCode from before match ergonomics and NLLs definitely feels pre-modern.
- efficax 4y agosort of? when i first learned it there was no async/await, no `?` operator for simplifying error handling, and lifetime elision was a whole other story, and you seemed to need lifetimes for any reference (can't remember but it's much better now). But is that really enough change for a new kind of rust (instead of just say, learning async rust vs normal rust?). not sure.
- jen20 4y agoIsn't this what "editions" are supposed to handle, in part?
- oconnor663 4y agoEditions are only necessary for otherwise-backwards-incompatible changes, to avoid breaking existing code. Even relatively major language features like the ? operator were shipped without an edition bump. But for example I think the await keyword itself was added as part of an edition, because it was incompatible with existing code that had a method named await. The messaging around the 2018 edition was a little different here, with some attempts to use the edition release as an opportunity to advertise and summarize all the features that had shipped since 2015. But I think folks decided that was confusing, and with the 2021 edition the messaging was toned down.
- jen20 4y agoYes, that's a fair point about the actual purpose of editions being to handle forwards-compatibility. Informally though, I think there are certainly a subset of people that use "Rust 2021" to mean all of the features included up to that point, even if it's not the precise definition.
- deleted 4y ago[deleted]
- givemeethekeys 4y agoThis is a good list, although it contains a lot of redundancy - at least, the first "how to learn" links - the youtube videos cover the same material over and over again. They are good - you may not need to watch every one in order as the author suggested. My approach has been considerably, uhh.. lazier, if you will: I just read through the rust book available on http://rust-lang.org http://rust-lang.org. It is easy to follow although, sometimes it doesn't fully explain the "why" behind certain things to idiots like me. For that, I turned to a quick online search, which brought up helpful blog posts, Reddit and Stack Overflow posts. Thats it. Next, I'll try to wrap my head around Actix to create a web server.
- hbn 4y agoSome people need to get with the picture and drop those antiquated 2021 practices. Puke!
- rcarmo 4y agoIt's a decent joke, but one of the reasons I only took up Go almost a decade after it got started was that I wanted to invest on a stable language ecosystem that wasn't after the fad of the week (like certain runtimes we all know). I'm actually looking forward to Rust having a few more years under its belt so I can do more than experimentation with it (and yes, I've seen the Oxide stuff, and there is plenty we can call stable right now -- I just want it to be a bit more weathered...).
- bryanlarsen 4y agoGo: started 2007, announced 2009, 1.0 2012 Rust: started 2006, announced 2010, 1.0 2015 The weathering on the two languages seems fairly similar. In fact it could be argued that Rust is more stable. Golang is talking about a breaking Go2, Rust has a fairly good forward compatibility story and plans.
- nindalf 4y agoI don’t think there’s any plan for a Go 2. I’m willing to bet we won’t see one in the next 10 years. The main feature that might have required breaking changes (generics) was introduced successfully without any breaking changes. Rust has no plans for 2.0 either. Both are stable languages that have been making steady progress.
- bryanlarsen 4y agohttps://zchee.github.io/golang-wiki/Go2/ https://zchee.github.io/golang-wiki/Go2/ https://www.youtube.com/watch?v=RIvL2ONhFBI https://www.youtube.com/watch?v=RIvL2ONhFBI
- 4y ago
- outside1234 4y agoMy first piece of advice is to just start writing code. If you are not specifically interested in super high performance systems level code, my second piece of advice would be to write code that avoids lifetime annotations until you get the basics of the borrow checker down. For me, this meant writing a gRPC API with Rust using `tonic` with a `diesel` based persistence backend and observability with `tracing` and `opentelemetry`. This gives you a good survey of the basics and you'll learn about all of the core traits and language features in the process.
- bryanlarsen 4y agoJust start coding while avoiding lifetimes is great advice, but that's easier said than done. Rust makes some hard things simple and exposes hidden complexity in things you thought were simple. Maybe I'd reframe it as "just start writing code, and use RC<> liberally to avoid lifetimes until you get a handle on them." Also avoid async for that first project too.
- outside1234 4y agoYes - that's also good advice (using Arc/RC to liberally avoid ownership issues). I've personally had good experiences with async, but I can also see how that could be challenging depending on the background you are coming from.
- jcuenod 4y agoThis is what I did. Still haven't figured out lifetimes or async, but I was impressed with how easily I managed to write something that works[1]... [1] https://github.com/jcuenod/clickhouse-set-cover https://github.com/jcuenod/clickhouse-set-cover
- Matthias247 4y agoSlightly off topic question/comment: You are running an async server, together with a blocking database client? That sounds more like a very tricky place ot get started. Are you dispatching all your database queries into an extra threadpool?
- denimnerd42 4y agowhat word are people going to use after modern. it's kind of like using the word new. we don't use modern rust around here anymore, just modern new new modern rust.
- timeon 4y agoIn other contexts they use word 'post-modern' and after 'post-modern' there is 'contemporary'.
- sysop073 4y agoA lot of people are getting really hung up on this. "Modern Rust" is just current Rust. Once Rust moves on, that will be modern Rust and what we once called modern will no longer be modern. Like all things. You might as well get upset that somebody said something will happen "tomorrow" because in 24 hours it won't be "tomorrow" anymore.
- denimnerd42 4y agoi didn’t mean rust. i meant any of these modern technology articles
- serial_dev 4y agoThis looks like a great resource, starred and upvoted. I'm planning to learn Rust next, going to start in a week after a job interview I had already lined up at Google. I worked with many languages professionally (JavaScript, TypeScript, Java, Python, Go, and now Dart) and many others at the university (C, C++, C#)... ...and Rust is very appealing to me. It's a modern language where the dev tools are straightforward, no need to deal with learning 30 years of legacy conventions, great performance that's on pair with C/C++, yet, at the same time high level and easy to read and reason about. The language is still young enough to make a dent in the ecosystem and build stuff for fun without people whining about JavaScript fatigue. It's versatile, so it can be used (at least theoretically) for web backend, frontend, desktop apps, command line tools, systems programming. It has all the good parts from OOP and FP. Yes, I'm at least partially responsible for having "xyz rewritten in Rust" almost every day in the top list on HN. One thing in a bit worried about is the job market, I've been paying attention to job adverts for months and I didn't see many companies that I'd like to join that use Rust in my area (Germany). Learning it and doubling down on Rust feel like a gamble, but at the same time, I can't imagine that Rust will not be one of the most important languages of the next decade.
- faitswulff 4y agoMost Rust jobs are in the blockchain space, which is unfortunate for those uninterested in blockchain technologies.
- nextos 4y agoMy impression is a bit different. I know a bit of Rust, and used to know C++98 inside out, but moved to more functional languages 15 years ago. I recently added a Rust keyword to my LinkedIn profile and Who's Hiring threads, just to test the waters. Many EU companies of all sizes got in touch with really interesting proposals. It's a systems programming language, so there are lots of problem domains it can cover.
- DMell 4y ago> I can't imagine that Rust will not be one of the most important languages of the next decade. As someone new to this industry, I'd love to hear a counter argument to this if anyone has one.
- spookierookie 4y agoSo Rust is now old enough for people to talk about "Modern" Rust? I'm either missing something or words don't mean what they used to...
- ygjb 4y agoIt's more than a decade old, and I have learned Rust on 3 occasions - first when I worked at Mozilla and heard about Rust as a project Graydon was working on at either a lunch and learn, or just chit chat around the Mozilla Vancouver office. Later I learned how to write some tools in Rust after not touching it in a few years when I changed companies. Finally, a year and half ago I had to actually start working in Rust on the regular as a dev and security engineer at Fastly. There were substantial changes in work flow and tooling each time I dove in and learned the correct way to do things.
- mayormcheeseman 4y agoHow’s your experience been working with Rust regularly in a professional environment?
- ygjb 4y agoI enjoyed it, but I changed jobs and companies a few months ago, and now I do spreadsheets and hold status meetings for a living :P Still using it for personal projects.
- 98sbs 4y agoCan I get a job with Rust?
- efficax 4y agoThey're out there! I found a gig at a startup not in the blockchain space working with Rust, but felt pretty lucky to find it. Most of the jobs are in crypto nonsense.
- beezlewax 4y agoWhy are there only those jobs?
- nindalf 4y agoMany software companies started in the last 3-4 years revolves around the blockchain. These were free to choose the best language suited to their use case. Many chose Rust, first released 7 years ago and started gaining momentum 3-4 years ago. It had good performance, fewer foot guns, good type system so it made sense for them. Companies that started before Rust gained critical mass might already have significant investments in one language and don’t want to rewrite. This is the majority of companies. Let’s say GitHub won’t rewrite their main Ruby application, but if they were writing a new code search backend, they might choose to write that in Rust. The majority of GitHub devs would continue to write Ruby. That means older companies (started before blockchain was hot) are going to skew towards older languages while newer companies are more likely to adopt newer tech.
- burntsushi 4y agoA lot of the links look reasonable. The substring section[1] looks a bit weird though. If you're learning Rust, diving right into how to work with char indices instead of byte offsets does not feel like the right thing to cover right away. You might really need that, but chances are you don't and would be much better served by a section that talks about how you probably don't want char offsets at all. But even that doesn't seem like you should whack a beginner with right away unless they have a specific hang-up on it. Beginner string stuff should be talking about string representation and going over the &str and String APIs. And depending on how early you get to it in the overall tutorial, probably using it as a springboard to talk about lifetimes. But writing code so you can go out of your way to do something that is probably wrong in the first place? Noooooo. Anyway, sorry to pick at this specific point, but the Gell-Mann amnesia effect comes to mind.[2] [1]: https://github.com/joaocarvalhoopen/How_to_learn_modern_Rust#rust-substring-processing https://github.com/joaocarvalhoopen/How_to_learn_modern_Rust... [2]: https://en.wikipedia.org/wiki/Michael_Crichton#GellMannAmnesiaEffect https://en.wikipedia.org/wiki/Michael_Crichton#GellMannAmnes...
- cutierust 4y agoI thought entrust was modern, now there is a modern rust too!? :P
- kbd 4y agoI've been meaning to dig my teeth into rust for a long time. JT's intro to Rust videos[1] are first on my list for when I can devote the uninterrupted hours. [1] https://youtu.be/gesNaLkUJeA https://youtu.be/gesNaLkUJeA
- nindalf 4y agoThis list undoubtedly took a lot of effort to compile, but I fear it might intimidate a newbie. I’d say the guide to learn modern rust could be much simpler - read The Book, write some code, and listen to Clippy (the linter) and apply rustfmt regularly. Almost all Rust code out there looks similar to each other because they pretty much follow this process - follow the standard linter and code formatter. The best part is, each Rust release introduces few changes so it’s easy to stay in tune with best practices.
- gremlinsinc 4y agoFour : Rust is what, less than a decade old? Rust itself is modern, there's no 'old' or 'ancient' rust, it's all modern, no?
- swah 4y agoThere is Rusty Rust and Shiny Rust...
- faitswulff 4y agoIf, on the other hand, you’re interested in pre-modern Rust, there’s always this repo: https://github.com/graydon/rust-prehistory https://github.com/graydon/rust-prehistory
- porknubbins 4y agoI love Rust and this is a great resource that I will certainly refer too, but I wonder if there is a little too much Rust language anxiety since we have a so many articles on "how to X in Rust". Doesn't that point to some complication if the thing being implemented is necessarily so tightly coupled with the language its implemented in (ie in a Write TCP in Rust type resource) that you need a special resource on how to to do it? There are some exceptions where like trying to do Linked Lists in Rust where the language will do everything it can to stop you, merits its own article.
- zinclozenge 4y agoI'd be really interested in a series that would go over how you might write code in one language (say c++, java, python, whatever), how you might try to write it in Rust and the problems it entails, and then how to write it properly. I haven't written Rust in 3-4 years, and trying to get back into it is painful.
- cush 4y agoWhy would this be better than the Rust Book? https://doc.rust-lang.org/stable/book/ https://doc.rust-lang.org/stable/book/
- jeff-davis 4y agoA lot of the frustrating parts seem to be related to async/await, and that seems lightly covered here. In particular, the intricate dependencies needed to do basic stuff, and choosing among many approaches.
- sn9 4y agoIs this a normal amount of studying to be considered an expert in a language? Like not a world authority, but an expert as far as professional software development hiring.