Jayjader Mod ,

I was reading this last evening and ultimately decide against pinging you with it at the time, lol.

It directly riffs off of, and complements, the article you posted. It also speaks to your remarks on an optional garbage collector, as well as "how to think about the lifetime/borrow checker/permissions interplay".

but I think I would have found it better to go from the basic idea of pointers as a way of not taking ownership

small quibble: String, Box, and Vec are all technically pointers that do take ownership (rather, they have ownership of what they're pointing to). It's really only "references" in Rust that don't take ownership. Which, IIRC, is more or less how The Book introduces references in chap 4. So I'm not really sure how what you're describing would differ from the current state of the book. Nonetheless, I understand the confusion that comes from "learning about" lifetimes so "late".

I suspect Rust is so complex, and like a living organism its parts have co-evolved together so much, that there is no linear explanation or introduction that can "truly" do it justice. You sort of have to throw yourself in, and repeat that process from a handful of directions/trajectories, to start to get a cohesive idea of the whole. I say "co-evolved" notably because so much of "modern" Rust seems to me to be syntactic sugar over "core/original/2015" rust.

I haven't gotten to the chapters on explicit lifetime annotation this time around, but I expect The Book to clearly state, then, that everything has a lifetime and the compiler actually infers most of them for you as part of this "syntactic sugar".

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • learningrustandlemmy@lemmy.ml
  • test
  • worldmews
  • mews
  • All magazines