Pre-RFC: Catching Functions

Repeating some of my concerns voiced in #rust-lang:

The only bit in this RFC I am not comfortable with is -> T catch E being sugar for Result<T, E> + some Ok-wrapping. I’d prefer if it instead was sugar for -> impl Try<Ok = T, Error = E> and from_ok-wrapping instead.

I think in general, it is better to hold the specific error monad abstract and then .into_result() at the top level of your stack of functions… I also think that this composes better.

Of course, not knowning that the type is Result means that using match directly on the result of a computation is not possible.

With respect to #[async] and “return types not being what they seem”, I don’t like seeing Result which is then converted to -> impl Future<..> this implicit conversion is not clear wrt. intent to me.

11 Likes