28 karma · joined Jul 8, 2022 (4y ago) · 15 submissions
comment 4y ago · link · parent
But if you are speaking about ergonomics of handling Options, it is being improved upon with the usage of try operators with Options as well as possibly seeing try expressions in the near future.
I don't think lack of ergonomics is a good justification for usage of unwrap, but that is entirely subjective. However, I do see the misappropriation of `unwrap` as a signal that the ergonomics in Rust are lacking and it's something that needs to be addressed, so again I do sympathize.
comment 4y ago · link · parent
See these for reference
* https://kotlinlang.org/docs/null-safety.html
* https://dart.dev/null-safety
* https://docs.microsoft.com/en-us/dotnet/csharp/nullable-refe...
An orthogonal approach would be using a data type such as Maybe or Option, but ergonomics depends on language.
comment 4y ago · link · parent
I agree, I love Rust, but I'd like to see error handling ergonomics improved.
I'd like to see error handling become more like Zig or Swift.
Until then, I cope with the `anyhow` and `thiserror` crate :|
comment 4y ago · link · parent
It sounds like this is coming from a C++ bias? So please forgive me if this is wrong.
Rust, in my experience, favors move semantics first, then copy semantics after.
I know in C++, we had implicit copy constructors, with move semantics after with rvalue references, where you need to use `std::move` in a lot of cases.
So what helps, in my opinion, is to think of Rust as using `std::move` as a default.
comment 4y ago · link · parent
Basically I'm encoding this approach in Java.