I agree with some of the caveats listed by other people here (in general, that this guide seems wishy-washy about what type of programmer it's catering to), but I like the memory layout tables. While I don't remember much about how I thought at the time I might have benefited from such a tutorial myself, when these days I mess around with exploits and the like which do weird things to memory, it often feels surprisin…
An alternative introduction to Rust
41–50 of 94 posts
Re: An alternative introduction to Rust
#42That was great, I was completely unfamiliar with Rust's borrowing system and now I think I understand it!
Re: An alternative introduction to Rust
#43I like the new structure much better! Now, I'm in no way a writer. English isn't even my main language.. So take this next point accordingly: Unfortunately, I get an even more condescending vibe from this draft than I got from the book. Not as in "I'm an expert and you're treating me like a newbie," but as if I was a kid instead of an aspiring Rust programmer (beginner or otherwise). I wish I could point out -exactly…
It's hard, for sure. There are certain sentence structures that strike certain people this way, and my style sometimes triggers them. For example, "basically" has no negative connotation for me, but really gets some people going, so I've been eliminating it wherever possible. I wonder which aspect does it for you... thanks for the brain dump, this is helpful.
Re: An alternative introduction to Rust
#44From someone reading about these details for the first time:
Calling them variable bindings confuses the matter. You say, just moments earlier, that variables are called by that name because they can change over time, they’re mutable. But this variable is immutable? But only sometimes? !
I know you mean that the mutability varies and that it makes sense in the context of the jargon of functional languages, but that's something that will make sense to language developers who have worked on Rust for years and maybe to the HN crowd, and not to new coders trying to grasp difficult, novel (to them) concepts.
How about "multimode bindings" or "multiphase bindings" (as in liquid/solid phase transitions) or dual-mode or something more entertaining like "double-agent bindings". Is it too late to change?
Maybe I'm missing something, but I suspect years from now people will be saying, 'so variable bindings are not always variable? huh?'
Re: An alternative introduction to Rust
#45> Rust’s variable bindings are immutable by default, but can become mutable, allowing them to be re-bound to something else From someone reading about these details for the first time: Calling them variable bindings confuses the matter. You say, just moments earlier, that variables are called by that name because they can change over time, they’re mutable . But this variable is immutable? But only sometimes? ! I know…
One way to view it is that the bindings don't have a value that is fixed at compile time: they vary between runs.
In any case, I'm not sure what you mean by "mutability varies".
Re: An alternative introduction to Rust
#46It definitely feels a little long winded for a person with some background already in systems langauages like C. Do you plan a TLDR for systems language people?
A Redditor put it best: > My only concern is that lot of the motivating of the ownership > system seems to be directed at C/C++ programmers, but at the same > time you're explaining pointers and memory management as almost new concepts. I think this is a weakenss of this draft, yeah. I want to make it accessible to non-systems people, but also okay for systems people. In the current, actual intro, I treat everything…
Being one who has "enjoyed" numerous encounters with C pointers (and pointers to pointers, etc.), a lot of the explanation seemed elementary indeed. But I didn't mind the "review", in fact, kind of fun imagining I was a beginner and how amazing it would be to learn the details.
I can see why Rust's concept of ownership is essential to grasp. However, the tutorial was a little murky when it came to the deeper subjects of "mutable borrow" and the cause of the example error.
It took a few readings to get what made the line "let x = &v[0];" so crucial: "...&mut is a promise that there are no other references...", i.e., meaning the promise to "x", since "x" is the recipient (owner?) of the "&mut" of "v".
The final paragraph is the key to the entire exposition, so it would be enormously helpful to take a few extra lines of text to clarify just how the expression "v.push("B");" violates the promise to "x". That's even more vital to your purpose as describing pointers in vivid detail.
People new to Rust are beginners re: ownership, borrowing, et.al., and would benefit from a step-by-step walk through of these less familiar parts.
Re: An alternative introduction to Rust
#47> Rust’s variable bindings are immutable by default, but can become mutable, allowing them to be re-bound to something else From someone reading about these details for the first time: Calling them variable bindings confuses the matter. You say, just moments earlier, that variables are called by that name because they can change over time, they’re mutable . But this variable is immutable? But only sometimes? ! I know…
Re: An alternative introduction to Rust
#48It definitely feels a little long winded for a person with some background already in systems langauages like C. Do you plan a TLDR for systems language people?
A very short TLDR, in my limited opinion, is basically "Take an ML-ish, make sure everything has C-like performance, while prohibiting all memory safety issues and eliminating aliasing". From those basic principles things you can start reasoning a lot about what Rust must do. But I agree it does feel a bit weird to need to explain pointers while also assuming people understand memory layouts. There should probably be…
Re: An alternative introduction to Rust
#49It definitely feels a little long winded for a person with some background already in systems langauages like C. Do you plan a TLDR for systems language people?
Not quite a TLDR, but this is a nice presentation by Lars Bergstrom that assumes more background knowledge: https://vimeo.com/120512790
I don't know of a succinct overview of Rust for experienced system programmers, and this video certainly isn't that.
Re: An alternative introduction to Rust
#50Earlier quoted context omitted.
A very short TLDR, in my limited opinion, is basically "Take an ML-ish, make sure everything has C-like performance, while prohibiting all memory safety issues and eliminating aliasing". From those basic principles things you can start reasoning a lot about what Rust must do. But I agree it does feel a bit weird to need to explain pointers while also assuming people understand memory layouts. There should probably be…
Note that Rust doesn't eliminate aliasing, it merely tracks it very precisely. Taking a reference is a trivial way to create an alias, though obviously while the alias is alive you are restricted in what you can do to the referent.