Live data from Hacker News

Rust for Professionals

overexact.com

31–40 of 103 posts

Re: Rust for Professionals

#31

Earlier quoted context omitted.

> The vast majority of beginners can just learn "& means any number of readers and no writers, &mut means one writer and no readers". But 'beginning' is never the hard part of learning any programming language, at least for a programmer. The hard part is going from having learned the basics to getting stuff done. Rust is harder than any other mainstream language to do that in. The writers in that thread can't even de…

The rust borrow checker has been described in trivial terms many times. The first time I had it explained, as I recall, was as a book. You own a book. `&` - You can lend others the book, they can't fuck with it. `&mut` - You can lend the book to one person, they can fuck with it `move` - You give someone else the book, it's theirs now Or `many reader NAND one writer` Is this a complete explanation? No. But it's quite…

OK, simple issue that a beginning Rust user runs into immediately:

  - function arguments are moved into the called function

  - you can call a function with a ref, and then you can keep using it in the calling function, because there is a blanket impl of Copy for refs

  - you can call a function with a ref mut, and then you can keep using it in the calling function because ... ???

Re: Rust for Professionals

#32
An important “unblocker” for me when learning Rust after decades of other languages was internalizing that assignment is destructive move by default. Like many Rust intros, this sort of glides past that in the “ownership” section, but I felt like it should be a big red headline.

If you’re coming from C++ especially, where the move/copy situation is ridiculously confusing (IMO), but also from a simpler “reference by default” language like Java, this has profound impact on what’s intuitive in the language.

For the C++ comparison, this is a pretty good article: https://radekvit.medium.com/move-semantics-in-c-and-rust-the...

Re: Rust for Professionals

#33

I keep saving these Rust resources for a near future... Am i the only one?? I really hope to start using Rust in 2023, probably for some kind of API gateway experimentation

Yeah I wish there was a strong jobs market for Rust developers then I'd feel like I wasn't wasting my time.

Re: Rust for Professionals

#34
post #33

I keep saving these Rust resources for a near future... Am i the only one?? I really hope to start using Rust in 2023, probably for some kind of API gateway experimentation

Yeah I wish there was a strong jobs market for Rust developers then I'd feel like I wasn't wasting my time.

There aren't many full Rust jobs but there are a whole lot of companies with ever expanding bits of Rust in production. Probably the best way at this point is to push it internally and put together a convincing case for using Rust for new projects.

Re: Rust for Professionals

#36

Earlier quoted context omitted.

> You truly don't find that hard or complicated? This is like saying: "You think a 64bit integer is simple? OK, let's dig into the C memory model, twos complement, overflow CPU flags, how CPU caches are implemented, architectural nuances that can lead to unsynced writes from registers to RAM, etc". In reality most people can just learn that it's a number that holds 2^64 values, not complicated. If you want to really…

> The vast majority of beginners can just learn "& means any number of readers and no writers, &mut means one writer and no readers". But 'beginning' is never the hard part of learning any programming language, at least for a programmer. The hard part is going from having learned the basics to getting stuff done. Rust is harder than any other mainstream language to do that in. The writers in that thread can't even de…

> Rust is harder than any other mainstream language to do that in.

I’d argue C and C++ are both harder. It’s hard to even get these to build once you move past trivia examples (including libraries etc).

> I find the denial of Rust's difficulty (and not even centred on the borrow checker - it's the use of just about every commmon library) just very very strange

Some of us just didn’t find it that hard. Like, I get that its hard for people in theory, because I’ve seen enough people express this that I believe it must be a common experience. But my personal experience was a couple of weeks of slow progress and lots of puzzling, and then everything became much easier, coupled with a joy that most of the language is so much better designed than the previous generation of languages I was used to using (e.g. it actually has sum types, and everything is an expression - why on earth doesn’t every language work like this)

Re: Rust for Professionals

#37
post #7

Earlier quoted context omitted.

AFAICT, the expectation is that the reader knows at least one modern programming language from the list, and maybe is acquainted in passing with a couple of others. So at least some comparisons should click. (They seemingly don't use more apt comparisons with OCaml and Haskell, for instance, not expecting the reader to know them.)

Javascript I've seen a decent amount and tweaked/edited some of code in it but I wouldn't say I "know" it at all. Kotlin I've never even seen before and I know literally nothing about the language. Java I wrote a bit of in high school but haven't touched it in 15 years. So yeah there's quite a lot that people wouldn't know.

You've said what languages you don't know, what languages do you know?

Re: Rust for Professionals

#38

Earlier quoted context omitted.

The rust borrow checker has been described in trivial terms many times. The first time I had it explained, as I recall, was as a book. You own a book. `&` - You can lend others the book, they can't fuck with it. `&mut` - You can lend the book to one person, they can fuck with it `move` - You give someone else the book, it's theirs now Or `many reader NAND one writer` Is this a complete explanation? No. But it's quite…

OK, simple issue that a beginning Rust user runs into immediately: - function arguments are moved into the called function - you can call a function with a ref, and then you can keep using it in the calling function, because there is a blanket impl of Copy for refs - you can call a function with a ref mut, and then you can keep using it in the calling function because ... ???

Because when you pass by reference, you lend the value (or to phrase it the other way around: the function borrows the value). And so when the function’s done, it gives you the value back (because that’s how borrowing works, in the everyday sense of the word, as well as in th Rust sense)

Re: Rust for Professionals

#40

Earlier quoted context omitted.

OK, simple issue that a beginning Rust user runs into immediately: - function arguments are moved into the called function - you can call a function with a ref, and then you can keep using it in the calling function, because there is a blanket impl of Copy for refs - you can call a function with a ref mut, and then you can keep using it in the calling function because ... ???

Because when you pass by reference, you lend the value (or to phrase it the other way around: the function borrows the value). And so when the function’s done, it gives you the value back (because that’s how borrowing works, in the everyday sense of the word, as well as in th Rust sense)

This is either wrong or incomplete. When you call a function `f()` with some `&mut`, the callee gets a `&mut`, not a borrowed `&mut &mut`. The callee doesn't borrow the ref mut, it gets the actual ref mut, and for some time you have multiple mutable references in the same scope. How?
Post reply on HN