News for hackers. Stuff that matters.
Re:I hate Rust (programming language) by n8henrie on Friday April 19, 2024 @06:50PM (#40092786)
> The problem was, of course, the fact that I didn’t copy-paste right the setup sequence

Sounds like the author did not specify the correct version of a dependency. It should not be surprising to find an incompatible API if using a (presumably) different major version number of a dependency, right?

I would say that failing to compile seems like a best-case scenario here. Serious question -- what would have been a better result in this situation?

Re:I hate Rust (programming language) by steveklabnik on Friday April 19, 2024 @09:38PM (#40093830)
Yes, the situation that happened here is that the rand package would have made a breaking change.

I haven’t heard of that being the case. The book’s code is tested in CI. I’m not saying it’s impossible, but I am saying it’s surprising. It’s certainly a bad experience, though, while the author is wrong about many things, he’s right about that.

Re:I hate Rust (programming language) by estebank on Sunday April 21, 2024 @06:04PM (#40109630)
I wonder if it could be a new manifestation of the long living problem of older resources appearing linked from random blogs or surfaced in web searches. I haven't seen that problem in a while, but could be one explanation for that.
Re:I hate Rust (programming language) by steveklabnik on Monday April 22, 2024 @03:00PM (#40117603)
Possibly, yeah. I haven't heard of that in a very long time either, but even then, if they were following the same code as on that resource, in theory it should have worked?

The current version of the book uses

[dependencies] rand = "0.8.5"

1.31.0 (the oldest I could find with the same URL, I don't remember when exactly the book shipped so maybe it's slightly off but whatever) uses

[dependencies]

rand = "0.3.14"

So yeah that's a lot of differences. But if they used the same code as the book, then it should have worked. So it's possible that:

1. they got an old resource but then used a newer version of rand, maybe by using `cargo add` instead?

2. rand had a breaking change somewhere along the way there, and they got unlucky

Guess we'll never know...

Re:I hate Rust (programming language) by estebank on Monday April 22, 2024 @05:44PM (#40121428)
> instead of choosing a certain numbered version of the random library (if I remember correctly) I let cargo download the latest version which had a completely different API.

Yeah, they didn't follow the instructions and got burned. I still think that multiple things went wrong simultaneously for that experience. I wonder if more prevalent uses of `#[doc(alias = "name")]` being leveraged by https://github.com/rust-lang/rust/pull/120730 (which now that I check only accounts for methods and not functions, I should get on that!) so that when changing APIs around people at least get a slightly better experience.

Re:I hate Rust (programming language) by steveklabnik on Monday April 22, 2024 @07:05PM (#40124683)
Ahhh nice catch. Yeah, I think that might help, but also, on some level, if people choose to not follow instructions, additional instructions don’t tend to help. Doesn’t mean it’s not worth trying in some circumstances, of course…