The `?` operator and a `Carrier` trait

As I said in the meeting, I'm excited to see progress on this front -- I would really like to be able to use ? with option values. That said, I think in the meeting we had decided to have some amount of discussion before we land the PR (and of course afterwards as well).

I think the main objection to allowing ? to operate on Option is that it blends together "error handling" (using Result type) and other kinds of "non-result" return values (which typically use Option). I've heard @wycats raise this argument, but @tomaka also raises a similar point in this comment:

The wording of the RFC is pretty clear about the fact that the ? operator is about propagating errors/"exceptions". Using Option to report an error is the wrong tool. Returning None is part of the normal workflow of a successful program, while returning Err always indicates an error.

Are there other concerns as well?

1 Like