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.

@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.

@timorl It's the most useful error propagation tool I've so far had my hands on; it is explicit and opt-in yet unobtrusive. What's there not to like?

@chrysn Kind of answered in the other toot, but in short:
1. Two types are treated very specially at the level of the language.
2. Afaik this is the only language feature that uses automatic coersion.

@timorl These two are odd, but github.com/rust-lang/rfcs/blob seems to improve the previous MVP into something more aligned. There will still be some auto-into-ing left, but with a trait backing it it'll be smoother.

@chrysn Oh that is *massively* better than the current situation, I didn't know about this RFC. Even the auto-coersion doesn't bother me that much, since now it's a strange artifact of the `Result` implementation rather than an inherent feature of the language. Thanks!

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.