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.

  • maegul@lemmy.ml
    link
    fedilink
    English
    arrow-up
    7
    arrow-down
    3
    ·
    1 year ago

    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@programming.dev
      link
      fedilink
      arrow-up
      20
      ·
      1 year ago

      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.

      • maegul@lemmy.ml
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        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@programming.dev
          link
          fedilink
          arrow-up
          2
          ·
          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.

    • MonkCanatella@sh.itjust.worksOP
      link
      fedilink
      arrow-up
      5
      ·
      1 year ago

      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

      • maegul@lemmy.ml
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 year ago

        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.

        • MonkCanatella@sh.itjust.worksOP
          link
          fedilink
          arrow-up
          2
          ·
          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.