Live data from Hacker News

Becoming Rustacean: Resources to Learn Rust Programming

nativebyx.dev

11–20 of 48 posts

Re: Becoming Rustacean: Resources to Learn Rust Programming

#11
post #10
post #2

I really like the speed of rust. It’s very difficult to learn it though

It is the speed of any compiled language to native code.

Oh, no, it isn't. Take the speed of Haskell or Prolog. They are much slower than Rust at runtime.

Re: Becoming Rustacean: Resources to Learn Rust Programming

#12
post #4

i think interactive tutorial works best for absolute beginners, it'd be great if anyone can provide link to the sources.

Absolute beginners seems like the wrong end to focus on if you want to actually be helpful. That stage lasts a couple of days at most. Every step you progress through requires more effort.

Of course content creators typically focus on beginners because there are always more beginners than intermediates, which is why there is so much shallow beginner content flooding the market in basically any conceivable topic.

Re: Becoming Rustacean: Resources to Learn Rust Programming

#13
post #3
post #2

I really like the speed of rust. It’s very difficult to learn it though

As someone who came mostly from Python and some C: I must say the most difficult part was stopping myself from forcing aesthetical ideas of how to structure code from the other languages into Rust. There are three points here: - Rust lends itself to certain structures (that you might not be used to) and makes others very harder to pull off (that you might be used to). The trick is not try to do the latter when the fo…

"the most difficult part was stopping myself from forcing aesthetical ideas of how to structure code from the other languages"

Coming from C and PHP to JavaScript gave me similar cognitive dissonance.

Syntactically these languages are very similar, but the semantics require to rethink quite much if what I learned.

Re: Becoming Rustacean: Resources to Learn Rust Programming

#14
post #4

i think interactive tutorial works best for absolute beginners, it'd be great if anyone can provide link to the sources.

https://rust-book.cs.brown.edu is a version of the Rust Programming language that adds exercises. It makes the learning experience interactive.

Re: Becoming Rustacean: Resources to Learn Rust Programming

#15
post #10
post #2

I really like the speed of rust. It’s very difficult to learn it though

It is the speed of any compiled language to native code.

I mean, that's probably true in some broad categorical sense, for the question of "speed of execution of final program" which it's not clear your parent meant.

However it's not true in the specifics, there are so often little tweaks Rust has that otherwise comparable languages don't have that squeeze out a little better performance and this adds up. For example:

C++ std::vector is a perfectly respectable growable array type right? But no less than Bjarne Stroustrup observes that actually, to his apparent surprise, the reserve() method on this type isn't very effective in using what a programmer knows about the growth of a particular instance for improving upon the amortized exponential growth curve. Rust's Vec is superficially the same type. But it has a subtly different API and in the process it unlocks what Bjarne missed, using Vec::reserve() does allow programmers to successfully guide the growth curve and benefit. [[If you need the equivalent of the C++ API, Rust provides Vec::reserve_exact() for you, but you probably don't]]

Still, for a lot of us there are more important "speeds" than the performance of running code. Rust does a lot of "shift left" on errors, where more of the defects in your first attempt to solve the problem are compiler errors, which you notice quickly and can fix, rather than them failing tests, being spotted in review, or worst of all, getting all the way to an actual user where they cause real problems.

One speed that Rust doesn't have on its side is compilation performance. Rust is not going to be the fastest language for turning correct high level code into running binaries.

Re: Becoming Rustacean: Resources to Learn Rust Programming

#16
The resources mentioned in this list are all pretty good. However, they might be intimidating for a beginner. A beginner wants one or two high quality sources to get started with. That's the Rust Book (https://doc.rust-lang.org/stable/book/) or the interactive version of the same book (https://rust-book.cs.brown.edu)

Also, not sure how this resource classifies Rust for Rustaceans as a beginner level book.

Re: Becoming Rustacean: Resources to Learn Rust Programming

#17
post #4

i think interactive tutorial works best for absolute beginners, it'd be great if anyone can provide link to the sources.

Absolute beginners seems like the wrong end to focus on if you want to actually be helpful. That stage lasts a couple of days at most. Every step you progress through requires more effort. Of course content creators typically focus on beginners because there are always more beginners than intermediates, which is why there is so much shallow beginner content flooding the market in basically any conceivable topic.

As you progress into more intermediate and expert understanding there's more and more nuance, which makes it harder to write good material anyway because there's always more you didn't cover.

Still, your observation is why Jon Gjengset's "Crust of Rust" series was created:

https://www.youtube.com/playlist?list=PLqbS7AVVErFiWDOAVrPt7...

Crust of Rust is not intended for people who didn't write any programs before, or even for people who've written a bunch of C++ but now are interested in learning Rust (actually those people might be successful with a fairly self-guided approach to get from zero to non-trivial program). Instead it's intended for the people who're beyond beginner but have specific things they don't "get". The first one is "Lifetime annotations" which is exactly the sort of thing that years of experience in BASIC, Javascript and C++ won't help with.

Re: Becoming Rustacean: Resources to Learn Rust Programming

#18
post #11
post #10

Earlier quoted context omitted.

It is the speed of any compiled language to native code.

Oh, no, it isn't. Take the speed of Haskell or Prolog. They are much slower than Rust at runtime.

There are even more:

  - Java (compiled AOT, anyone remembers how dead slow code GCJ produced?)
  - Go (not always as bad as Java, but not perfect either)

Re: Becoming Rustacean: Resources to Learn Rust Programming

#19
post #10

Earlier quoted context omitted.

It is the speed of any compiled language to native code.

I mean, that's probably true in some broad categorical sense, for the question of "speed of execution of final program" which it's not clear your parent meant. However it's not true in the specifics, there are so often little tweaks Rust has that otherwise comparable languages don't have that squeeze out a little better performance and this adds up. For example: C++ std::vector is a perfectly respectable growable arr…

> One speed that Rust doesn't have on its side is compilation performance.

I noticed that `cargo check` alone is plenty fast, and when you give it a program with a type issue to check, it reports errors nearly instantaneously (So this is probably not all the type checking (including borrowchecking) that slows things down, but the phases that happen later, likely code generation. Which leads me to a question - why is code generation so slow even in debug mode compared to other compiled languages? (this is one thing that Golang does right).

Re: Becoming Rustacean: Resources to Learn Rust Programming

#20
post #13
post #3

Earlier quoted context omitted.

As someone who came mostly from Python and some C: I must say the most difficult part was stopping myself from forcing aesthetical ideas of how to structure code from the other languages into Rust. There are three points here: - Rust lends itself to certain structures (that you might not be used to) and makes others very harder to pull off (that you might be used to). The trick is not try to do the latter when the fo…

"the most difficult part was stopping myself from forcing aesthetical ideas of how to structure code from the other languages" Coming from C and PHP to JavaScript gave me similar cognitive dissonance. Syntactically these languages are very similar, but the semantics require to rethink quite much if what I learned.

Yeah, I wish there was a good list of things to hint you aren't being rusty. When you are cloning everything or have arc on everything that is a pretty good hint, but I'm sure someone could put together a better list than I could.
Post reply on HN