Live data from Hacker News

A Gentle Introduction to Rust

stevedonovan.github.io

1–10 of 60 posts

Re: A Gentle Introduction to Rust

#3
Speaking as someone who's poked around at the edges of Rust and always come away frustrated, the Rust world does need a "gentle introduction". But while this document seems to understand that need, it gets messy pretty fast.

First of all, the introduction is all over the place, and poorly structured. There first section asks "Why Learn a new Programming Language?" but never answers that question (beyond "it's good mental exercise"), and follows it up with a section labelled "Where Rust Shines" that instead vaguely compares its memory management approach to C, calls C a "cowboy language", lists some of Rust's design components (not really even principles, just aspects of the language), and then starts giving advice for how to learn a programming language in general? What?

Next is Hello World, and immediately "Rust is a curly-braces language with semicolons, C++-style comments and a main function - so far, so familiar." Well, to C++/Java/Javascript programmers, maybe it is familiar. That may well be a huge part of your intended audience, but this gloss of the basics is a big red flag about what assumptions might be made further on.

"The exclamation mark indicates that this is a macro call. For C++ programmers, this can be a turn-off, since they are used to seriously stupid C macros"

Whoa, there, cowboy! This is Hello World! Mentioning macros at all should probably be reserved for a little later, much less vaguely referencing the C preprocessor's bad repuation. Then the tangent about "OMG, you mean I have to type an exclamation point!?" is telling, though. At this point in a gentle introduction, you probably shouldn't be already alluding to the trash talking about the language.

We aren't even past the first example. Further down the page, there's some big talk about how Rust favors explicitness, immediately followed by a discussion of how all the types are implicit and how confusing that can be. No mention of how you would remember that `f64` is the default floating point type...

This is a worthy attempt and probably a good first draft. It's definitely a document that needs to exist, but in its current state, it's an gentle intro that only a disaffected C++ programmer could love. But please keep working on it--I need something like this.

Re: A Gentle Introduction to Rust

#4
Really enjoyed the section on error handling. I had read similar sections in the rust book, but something about this explanation really made things click for me! As much as I love Rust, I personally found it a little difficult to get used to the error handling coming from an language like JS which cares little about appropriate handling

Re: A Gentle Introduction to Rust

#5

Speaking as someone who's poked around at the edges of Rust and always come away frustrated, the Rust world does need a "gentle introduction". But while this document seems to understand that need, it gets messy pretty fast. First of all, the introduction is all over the place, and poorly structured. There first section asks "Why Learn a new Programming Language?" but never answers that question (beyond "it's good me…

> No mention of how you would remember that `f64` is the default floating point type

While the default is `f64`, it's only used if the type can't be inferred otherwise.

If the author had changed the `f64` in the code sample to `f32`, type inference would have made the float literal to be an `f32` to match.

That is a little complicated to explain, but the UX is such that literals generally "just work".

Re: A Gentle Introduction to Rust

#9
post #7

Why does every single rust promoting article have to bash on c++? They built a GC, good job. But, surely there is something else more worthy of typing about when hyping the language?

> Why does every single rust promoting article have to bash on c++?

Because it was built to be a C/C++ replacement.

> They built a GC, good job.

?

Re: A Gentle Introduction to Rust

#10
post #7

Why does every single rust promoting article have to bash on c++? They built a GC, good job. But, surely there is something else more worthy of typing about when hyping the language?

Rust finally provides an alternative to C++ in one of the few niches that still mandated C/C++, and now that there is an alternative, it's easy for people to get carried away with evangelism.
Post reply on HN