this post was submitted on 25 Sep 2023
88 points (96.8% liked)

Programming

17303 readers
75 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
 

cross-posted from: https://sh.itjust.works/post/5850736

This is the resource I've been looking for. I'm working my way through the book but it gets in the weeds really early. It's all fun and games and then chapter 4 just hits like a brick wall. Amos does a tremendous job explaining the why behind things, in a more wheels to the pavement way.

top 12 comments
sorted by: hot top controversial new old
[–] [email protected] 8 points 1 year ago (1 children)

Yeah, all of Amos's content is gold. I highly recommend his executable packer series if you get into systems work - very interesting stuff.

[–] xoggy 2 points 1 year ago

The blog and videos are great. His constant stream of thoughts from Mastodon might be too much Amos content in my life though.

[–] Mikina 6 points 1 year ago (1 children)

I've just started learning Rust, mostly by experimenting with winapi since that what's I'm mostly going to use it for anyway, but this finally explains why I had so much trouble with trying to intuitively winging it. I've skimmed through the Rust book once, but judging by this article it's no wonder I was mostly wrestling the compiler.

Looks like I have to go back to the drawing board. I understand why is Rust doing it, and I'm sure that once I finally get used to it, it's going to be a way smoother experience, but maan, this is the first language I couldn't just figure out in an hour. It's a frustrating learning experience, but I also see why it's neccessary and love it for that.

[–] [email protected] 1 points 1 year ago (1 children)

I've had a few challenging moments for sure but I'm really loving it. I come javascript mostly with a fair amount of ruby experience, and C++ dating back to college. C++ was by far more difficult to learn, but this was like 15 years ago and learning resources have changed drastically since then. To me Rust feels like low level Ruby. I think it takes some good DX cues from Ruby.

[–] Mikina 2 points 1 year ago

I've been mostly working in C# for the past few years (and most of my life), and the only C++ experience I have is from college, so it's getting some using to. And that's what I was getting at - thanks to college, where I was forced to really learn (or at least, understand and be able to use) a wide range of drastically different languages, from Lisp through Bash, Pharo, Prolog, to Java and C#, that when I have to write something in a language I don't know, it's usually similar to at least one of them and I always could figure it out intuitively.

With Rust, even though it has an amazing compiler, I'm struggling - probably because of the borrowing and overly careful error handling being concepts I've never had to deal with to get a MVP code working. Sure, that probably means that the code wasn't error-proof, which is exactly what Rust forces you to do and which is amazing, but it makes it a lot harder to just write a single script without prior knowledge when you have to.

I hope they are teaching Rust at universities now, we definitely didn't have it 8 years ago, which is a shame.

[–] [email protected] 4 points 1 year ago (2 children)

Oh man ... I haven't learnt rust myself, but this fits with my sterotyped impression of it ... wanna read a file ... well, let's just wrestle with the type system and compiler for half an hour first!

Not a criticism ... I get the value of the type system and all that, but as an introduction to the language, diving into all that straight away before you do any actual computation is probably not the best way to go.

[–] Ogeon 22 points 1 year ago (1 children)

Static types aside, the file system has a lot of failure cases, which every language is affected by, and Rust makes them very visible. This can indeed feel like a lot, but it's an intentional feature and makes more sense in larger projects. I guess the feeling may get amplified by the author's style of long form posts with a lot of details.

Error handling in practice contains a lot of "let the caller deal with it", using the ? operator to pass errors up the call stack. The more verbose options are for when you need to actually handle it.

[–] [email protected] 2 points 1 year ago (1 children)

the file system has a lot of failure cases

Oh for sure, like I said this makes a lot of sense. All I was saying was that as a pitch for learning the language, the part after the file read had been sorted was much more compelling and interesting.

[–] Ogeon 2 points 1 year ago

Absolutely, I didn't mean to suggest otherwise. :) I'm just giving a bit of context and perspective from someone who has used it for a while.

[–] [email protected] 5 points 1 year ago (1 children)

Yes, not to knock the book because it is really well done, but it gets theory deep before you're able to apply that theory in a way that makes it make sense. It's like someone describing the theory of gravity to you to teach you how to play basketball

[–] [email protected] 2 points 1 year ago (1 children)

Yea I can imagine.

I'm a pretty big believer in understanding the problem that needs solving before understanding the solution. I'd imagine that gets a bit tricky with rust because the compiler is just not gonna let you run the "problematic" program.

Now that I'm thinking this out loud ... maybe a good way to learn rust would be by using and contrasting it with another language to see what rust is giving you that the other language doesn't. Most are probably coming to rust from knowing a few languages already too.

[–] [email protected] 2 points 1 year ago

To be fair, Rust is far from the hardest language I've learned. That honor would go to C++. I'm actually really enjoying it. But I'd maybe compare to learning english. You can learn all the funky grammar rules, the funky spelling, the history that went behind all that funkiness. But it's filled with so many idioms that are just kinda baked in and not written down that it can get confusing fairly easily.