by steveklabnik · 6y ago · 0 comments
That is, I don't dis-believe your experience. It's just so, so so hard to reproduce these things, and it happens to every language to some degree. Measuring that degree is very hard, and also, Google personalizes results, so it's impossible to recreate.
I don't expect you to have this handy, but if you had data, that is, what posts you found, what you searched for, that would be helpful.
Most users do not report this experience, though I'm sure that's survivorship bias.
Don't mind the downvotes as I just wrote from vague memory without properly verifying things.
I tried to look through my Google history to see how I landed into that specific problem. But was not able to find out how exactly I landed on that syntax issue about writing files. If it helps here is my chronological Google Search and visit history on that day about how I finally went from "try" macro to understanding how "?" operator is used in Rust.
* Searched for "try macro rust"
* Visited "std::try! - Rust"
* Visited "Learning to 'try!' things in Rust - Jonathan Turner"
* Searched for "rust expected expression, found reserved keyword `try`"
* Visited "Try keyword reservation breaks macro try - The Rust Programming ..."
* Searched for "rust try macro removed"
* Visited "Error Handling - The Rust Programming Language"
* Visited "How to use ? and catch in Rust? - Stack Overflow"
* Searched for "rust optional unwrapping"
* Visited "What is unwrap in Rust, and what is it used for? - Stack Overflow"
* Visited "Killing unwrap() • Dimitri Merejkowsky - dmerej.info"
* Searched for "rust ? operator"
* Visited "The ? operator for easier error handling - The Edition Guide"
Adding insult to injury, not that it is specific to Rust, there are so many bloggers out there that don't put a date and/or give version of the software they're talking about that you just can't know if the info is correct or obsolete.
One of my first trial programs in any language is a tcptraceroute, since it's a good mix of super-beginner tasks and one slightly advanced thing. I hit a problem in Rust right at the beginning: obviously I need to make a socket, but which crate do I use, "socket" or "socket2"? Socket doesn't build anymore, but it's still available as a crate and I have to include it as a dependency and "cargo build" my project to find out that it doesn't work. To make it more frustrating, the only other example of a Rust traceroute that I found uses socket, not socket2, so it doesn't build anymore, either.
I did figure it out, but it felt like an unnecessary speedbump.