Could the RFC be broken down into stages:
- Try to default to
! in all situations rather than just some as Rust does today.
Could we do this first, evaluate how it works in practice, then use that to inform the debate on other parts of this proposal. I think the above would be less controversial since there is no new syntax, it just means some valid programs pass that would have failed before. I don’t know how this relates to async functions as I haven’t really been following the discussion there.
I think that there are real improvements to be had in ergonomics with this RFC, or another similar one, and I think this RFC is an important addition to the debate. It would be nice to avoid new syntax though, and I havn’t thought enough about the consequences of this - does it simplify code or make it more complicated by introducing “compiler magic”. I think simplifies, since taking the example
fn gen_error() -> impl Error {
unimplemented!();
}
I think it’s reasonable to accept this program (if we have impl Error for !), since the return type of the function body is !. Also I don’t think it gets counter-intuitive if we increase complexity
fn construct_ok<T, E>(val: T) -> Result<T, E> {
Ok(val)
}
However in this case I think it would be clearer written like
fn construct_ok<T>(val: T) -> Result<T, !> {
Ok(val)
}
. We would then need ! to coerce into any other type - I don’t know if that is part of the never proposal.