After actually working with it a bit, I still think might be one of the more reasonable popular languages out there, but the semantics of the `?` operator are stupid. It looks like the result of an oath to include it in the language, whatever the cost, between two drunken developers – one from Go one from Haskell.

Follow

@timorl Which part of its semantics and what do you usually want to do instead? (And what would you prefer something-like-? to do instead?)

@robryk I don't particularly like that it treats two types very specially at the level of the language – it would be better if it at least referred to a trait, which one could implement on any type. But I could understand if it was just that, maybe the convenience is worth making the language slightly uglier. What actually convinced me `?` is a mistake is the difference between `f()` and `Ok(f()?)`. As far as I know `?` is the only inherent feature of Rust that performs automatic coersion. Introducing this to the language cannot be worth it.

It would be completely fine as a macro – either `try!` as it used to be or a macro that rewrites `?`s in a function. The latter would preferably have an option for turning automatic coersion on/off, but even if it didn't I wouldn't care that much, as it wouldn't be a inherent feature of the language.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.