Re:How I went about learning Rust
by zozbot234 on Friday July 15, 2022 @02:28AM
(#32105235)
Since you're coming from a NodeJS background, you'll want to pick up an introductory textbook about C as well. Rust implicitly relies quite closely on the C machine model, and introductory books about Rust (such as "The Rust Programming Language") don't do a very good job of conveying the nitty-gritty details of that model to novice coders. This is a pretty nasty pitfall when trying to code in Rust, and it's important to address it early.
[ Parent
| on HN ]
I'm self-publishing "Rust From the Ground Up" which takes this approach: each chapter rewrites a classic Unix utility (head, cat, wc, ...) from the original BSD C source into Rust. I find for systems programming it's easier to understand how things work in C, and then teach the idiomatic way of doing it in Rust. C is pretty easy to follow along in "read-only" mode with some explanations.
Re:How I went about learning Rust
by cercatrova on Friday July 15, 2022 @10:22AM
(#32108494)
Interesting, seems similar to the book Command Line Rust which also teaches you by reimplementing Unix commands, any thoughts on the differences?
Yes I saw that... I released mine first but I'm publishing it a chapter at a time and mine is about half done. I haven't read the O'Reilly one because I don't want to inadvertently copy anything or be influenced by it. I think the main difference between my book and this one is that I go through the original BSD source and translate it into idiomatic Rust. I also teach how to work with the borrow checker without resorting to copy/clone or reference counting which I think is unique. And I don't use lifetimes anywhere in the book - they're an advanced topic that really puts off new Rust programmers and aren't needed in most cases.
Nice, is the BSD C source unchanged in the book?
Yes! I use the (final) 4.4 release from 1993. Some were written by Bill Joy! But if you look at the modern OpenBSD or FreeBSD (or MacOS) versions they’re still about 90% unchanged. The older versions are a bit shorter which makes it easier to explain.
Re:How I went about learning Rust
by vladvasiliu on Friday July 15, 2022 @03:02AM
(#32105460)
I second this.
I've learned Rust after having used Python, and at first I had a few "wtf" moments, things I just couldn't understand.
Everything fell into place after discussing these with a friend who knows much more about the "nitty-gritty" than I do.
Reading an entire book on C is probably overkill. This video is probably enough for most beginners: https://www.youtube.com/watch?v=rDoqT-a6UFg
Re:How I went about learning Rust
by intelijstupide on Saturday July 16, 2022 @05:40AM
(#32116492)
Wow thank's for that link. Bridged a few gaps for me between what I remember from c++ and what I've been learning in rustlings.
Re:How I went about learning Rust
by doctor_eval on Friday July 15, 2022 @03:35AM
(#32105690)
This is the main reason I’d recommend that a Node programmer learn Go first.
I haven’t learned Rust yet, thought I’m quite keen to do so, but I have an (ancient) background in C, C++ and 8-bit assembly. I don’t find that I really use much of that knowledge when I work in Go, even though Go is still a lot closer to the metal than Node.