Live data from Hacker News

Flattening Rust’s learning curve

corrode.dev

51–60 of 405 posts

Re: Flattening Rust’s learning curve

#51
post #18

It's like reading "A Discipline of Programming", by Dijkstra. That morality play approach was needed back then, because nobody knew how to think about this stuff. Most explanations of ownership in Rust are far too wordy. See [1]. The core concepts are mostly there, but hidden under all the examples. - Each data object in Rust has exactly one owner. - Ownership can be transferred in ways that preserve the one-owner ru…

And, after someone who doesn't know rust reads this neat and nice summary, they would still know nothing about rust. (Except "this language's compiler must have some black magic in it.")

Re: Flattening Rust’s learning curve

#52

A learning curve measures time on the x axis and progress on the y axis. A flat learning curve means you never learn anything :-\

This is incorrect. A learning curve measures expertise on the x axis and effort on the y axis. Hence the saying "steep learning curve".

Re: Flattening Rust’s learning curve

#53

A learning curve measures time on the x axis and progress on the y axis. A flat learning curve means you never learn anything :-\

It should be called "learning hill" instead.

People (colloquially) use phrases like "steep learning curve" because they imagine learning curve is something you climb up, a.k.a. a hill.

Re: Flattening Rust’s learning curve

#54

Regarding the first example, the longest() function, why couldn't the compiler figure it out itself? What is the design flaw?

It's a design choice.

To make a compiler automatically handle all of the cases like that, you will need to do an extensive static analysis, which would make compiling take forever.

Re: Flattening Rust’s learning curve

#55

A learning curve measures time on the x axis and progress on the y axis. A flat learning curve means you never learn anything :-\

This is incorrect. A learning curve measures expertise on the x axis and effort on the y axis. Hence the saying "steep learning curve".

https://en.wikipedia.org/wiki/Learning_curve

Re: Flattening Rust’s learning curve

#56

[flagged]

I have taken the time to learn rust and you're absolutely right. It's a very complex, design-by-committee language. It has brilliant tooling, and is still much less complex than it's design-by-committee competitor C++, but it will never be easy to learn.

Re: Flattening Rust’s learning curve

#57
post #34

Rust is wonderful but humbling! It has a built in coach: the borrow checker! Borrow checker wouldn't get off my damn case - errors after errors - so I gave in. I allowed it to teach me - compile error by compile error - the proper way to do a threadsafe shared-memory ringbuffer. I was convinced I knew. I didn't. C and C++ lack ownership semantics so their compilers can't coach you. Everyone should learn Rust. You nev…

"Rust is wonderful but humbling!" It's an abstraction and convenience to avoid fiddling with registers and memory and that at the lowest level. Everyone might enjoy their computation platform of their choice in their own way. No need to require one way nor another. You might feel all fired up about a particular high level language that you think abstracts and deploys in a way you think is right. Not everyone does. Yo…

Wow who pissed in your coffee? he likes rust ok?

Re: Flattening Rust’s learning curve

#58
post #37

Is there a concise document that explains major decisions behind Rust language design for those who know C++? Not a newbie tutorial, just straight to the point: why in-place mutability instead of other options, why encourage stack allocation, what problems with C++ does it solve and at what cost, etc.

Rust has better defaults for types than C++, largely because the C++ defaults came from C. Rust is more ergonomic in this regard. If you designed C++ today, it would likely adopt many of these defaults.

However, for high-performance systems software specifically, objects often have intrinsically ambiguous ownership and lifetimes that are only resolvable at runtime. Rust has a pretty rigid view of such things. In these cases C++ is much more ergonomic because objects with these properties are essentially outside the Rust model.

In my own mental model, Rust is what Java maybe should have been. It makes too many compromises for low-level systems code such that it has poor ergonomics for that use case.

Re: Flattening Rust’s learning curve

#59
post #43
post #37

Is there a concise document that explains major decisions behind Rust language design for those who know C++? Not a newbie tutorial, just straight to the point: why in-place mutability instead of other options, why encourage stack allocation, what problems with C++ does it solve and at what cost, etc.

I think the major decisions behind Rust is being explicit and making the programmer make decisions. No NULLs, no Implicit conversions, no dangling pointers. Lifetimes, Optional, Results, each Match branch needs to exist, etc. Side note: Stack allocation is faster to execute as there's a higher probability of it being cached. Here is a free book for a C++ to Rust explanation. https://vnduongthanhtung.gitbooks.io/migra…

> being explicit and making the programmer make decisions

Why RAII then?

> C++ to Rust explanation

I've seen this one. It is very newbie oriented, filled with trivial examples and doesn't even have Rust refs to C++ smart pointers comparison table.

Re: Flattening Rust’s learning curve

#60
post #34

Earlier quoted context omitted.

"Rust is wonderful but humbling!" It's an abstraction and convenience to avoid fiddling with registers and memory and that at the lowest level. Everyone might enjoy their computation platform of their choice in their own way. No need to require one way nor another. You might feel all fired up about a particular high level language that you think abstracts and deploys in a way you think is right. Not everyone does. Yo…

Wow who pissed in your coffee? he likes rust ok?

And he's telling other people they should like it as well, because he has seen the light.

My gut feeling says that there's a fair bit of Stockholm Syndrome involved in the attachments people form with Rust.

You could see similar behavioral issues with C++ back in the days, but Rust takes it to another level.

Post reply on HN