3 ms·
> However, ? for Option is a bit controversial Because people wouldn't expect it to return due to behaviour of existing languages yet that's what it does in Ru
by masklinn 10y ago
> However, ? for Option is a bit controversial
Because people wouldn't expect it to return due to behaviour of existing languages yet that's what it does in Rust?
- Rusky 10y agoMore because Option is not really intended to handle errors while Result and ? are.
- steveklabnik 10y agoYes, that's correct. If we make ? go to more than just result, you could implement it for any type, and it's not totally clear that changing it from "error handling" to "general control flow" is a good idea. Many are in favor of doing it, though. I'm personally against it.
- int_19h 10y agoWhether it's ? or something else, having a very concise form of syntactic sugar to unwrap option types is desirable. Most languages that don't have it, eventually acquire it due to demand.