3 ms·
I mean "unwrap()" and "panic!() are right there for "blow up and don't care", if you're really just doing throwaway scripting that should be enough. And the "?
by lamontcg 4y ago
I mean "unwrap()" and "panic!() are right there for "blow up and don't care", if you're really just doing throwaway scripting that should be enough.
And the "?" operator is way more ergonomic for throwing actual errors up a level than all the boilerplate in Go.
The pattern matching with `match` `if let` and `let else` are pretty easy to use to unwrap Result and Option enums.
And then the "anyhow" or "thiserror" crates make it all more ergonomic.
The end result is something is much more readable than all the error handling in Go, while still being at least as safe if not more safe.
Plus you wind up playing with Monads without needing to know what the hell an endofunctor is.
And there's no null/nil, while Options have to be explicit and if you squint (because of the presbyopia) they look kinda like the nillable stuff in C# 8.0
- rbetts 4y agoKind of an ironic reply - naming 10 Rust features and libraries vs. an `if` check in Go to argue that Rust has simpler ergonomics for throw-away code.
- lamontcg 4y agoMy response covered the gamut from throw away code up to error handling in professionally written code, with a diversion through "null" handling. To reiterate, for throw away code (or tests) unwrap() and panic!() will work just fine.
- aprdm 4y ago> code up to error handling in professionally written code Lol, if you knew how much python code runs the world without even checking for exceptions, or with a try/except/pass ... and the world keeps on spinning. "professionally written code" made me chuckle
- lamontcg 4y agoYeah I'm done with the trolls here.
- aquariusDue 4y agoI never understood the pearl clutching going on when people hear that Rust has different constructs for handling errors and control flow and if/else stuff is kinda an antipattern. Same kind of people that would hold dear GOTO statements in my opinion.
- lamontcg 4y agoWell the responses here are just a little bit more conviction that I'm on the right path with Rust.
- aprdm 4y agoNot sure if you're being sarcastic or serious