Live data from Hacker News

How to Learn Modern Rust

github.com

21–30 of 67 posts

Re: How to Learn Modern Rust

#24
A 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...

[2]: https://en.wikipedia.org/wiki/Michael_Crichton#GellMannAmnes...

Re: How to Learn Modern Rust

#25

Is Rust old enough for there to be a 'modern' Rust?

sort 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.

Re: How to Learn Modern Rust

#26

My 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 `op…

Just 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.

Yes - 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.

Re: How to Learn Modern Rust

#30
This 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.

Post reply on HN