Live data from Hacker News

A half-hour to learn Rust

fasterthanli.me

141–150 of 150 posts

Re: A half-hour to learn Rust

#141
I've been writing Rust for about 2 years, I read this and learned all kinds of stuff I still did not know. Fantastic job on this! I am now a bit upset that everything isn't taught this well :o

Re: A half-hour to learn Rust

#142
this is the style that let me get into python reading a python book by new riders within 3 days. i replace perl based module within a week of reading.

this: teaching material should give immediate confidence to apply learned material and - refine it later.

excellent write up

Re: A half-hour to learn Rust

#143
post #55

Earlier quoted context omitted.

None of them. The concept is fundamentally flawed. It's as if everything you ever read about C was all about bitwise manipulation operations, on and on and on about bitwise manipulation, to the point not-C programmers think the language is primarily about bitwise manipulation and people start porting bizarre misunderstandings of bitwise manipulation into other languages and claiming they're just like C now, when it's…

However, the c community never felt like going on and on and on about bitwise manipulation... Anyone have any idea why people get so hung up about explaining monads?

For C it was about the pointers.

Re: A half-hour to learn Rust

#144
post #102

I want books written like this. I've had too many books where I die of boredom over and over again in the first 150 pages and then I never read them again. It's like there's some rule saying books must be super wordy.

That rule is usually called the publication contract, and it usually literally says how big the work needs to be, even if you can say it better in fewer words/pages/chapters/etc.

TIL. This seems to be waste of paper/time for consumers. What is the incentive for publishers by preferring wordy version than terse one? Is it because they afraid of being perceived as not worthy enough to be a book?

Re: A half-hour to learn Rust

#145

This is very good but... Description of traits suddenly dumps references, mutable references, reference bindings, dereferencing with zero explanation: --- start quote --- Trait methods can also take self by reference or mutable reference: impl std::clone::Clone for Number { fn clone(&self) -> Self { Self { ..*self } } } --- end quote --- What? What does this even mean? What is self, and why ? Too many questions, not…

If you have a struct of type T and an instance of that struct t, you can create a new instance using the syntax

  T { ..t }
which means "a new T with all the fields set to their values in t".

Inside the trait "Self" is an alias for "Number".

"&self" is shorthand for "self: &Number", i.e., a reference to Number.

To dereference a reference, prefix with

  *
So:

  self
has type "&Number"

and

  *self
has type "Number".

Thus,

  Self { ..*self }
is creating a new instance of Number with its each set to the same value as self.

Disclaimer! everything I know about rust I learned 2 days ago from this blog post, so I might be wrong :-)

Re: A half-hour to learn Rust

#146

Earlier quoted context omitted.

That rule is usually called the publication contract, and it usually literally says how big the work needs to be, even if you can say it better in fewer words/pages/chapters/etc.

TIL. This seems to be waste of paper/time for consumers. What is the incentive for publishers by preferring wordy version than terse one? Is it because they afraid of being perceived as not worthy enough to be a book?

Holdover from another era. Pre-internet, we had more time to spend w/ books, and it was harder to gain context to make things make sense -- a little hand-holding and digression was more appropriate then.

Re: A half-hour to learn Rust

#147
post #58

Serious question; why aren't we all using Rust?

I think for a lot of use cases, the safety and security and whatnots you get from Rust just aren't required and people already have a large time investment in Python/Go/Java/etc.

Certainly I can do pretty much everything I need to with C/Python/Go because I accept the tradeoffs and know enough to work around the safety/security issues.

(But Rust is on my list of things to get around to in 2020.)

Re: A half-hour to learn Rust

#148

This is the most useful introduction to a language I have ever read. Often language introductions produce a "Wall of Complexity" and I failed in my last two attempts learning Rust failed because of that. This is just great. Be warned, the "half hour" part is probably a bit like "99 cents" as a price tag. I've already spent more than that, but it is time well spent. Thanks for writing this!

> This is the most useful introduction to a language I have ever read. Often language introductions produce a "Wall of Complexity" and I failed in my last two attempts learning Rust failed because of that. This is just great.

> Be warned, the "half hour" part is probably a bit like "99 cents" as a price tag. I've already spent more than that, but it is time well spent.

> Thanks for writing this!

Re: A half-hour to learn Rust

#149
post #148

This is the most useful introduction to a language I have ever read. Often language introductions produce a "Wall of Complexity" and I failed in my last two attempts learning Rust failed because of that. This is just great. Be warned, the "half hour" part is probably a bit like "99 cents" as a price tag. I've already spent more than that, but it is time well spent. Thanks for writing this!

> This is the most useful introduction to a language I have ever read. Often language introductions produce a "Wall of Complexity" and I failed in my last two attempts learning Rust failed because of that. This is just great. > Be warned, the "half hour" part is probably a bit like "99 cents" as a price tag. I've already spent more than that, but it is time well spent. > Thanks for writing this!

whoops, sorry.
Post reply on HN