I am generally in favor of this proposal. It seems to be a reasonable
way forward. It is unclear to me how many types would benefit from
this approach of having methods for each variant, but `Result`
certainly does.

With respect to possible confusion between `is_ok()` and `ok()` -- I
think that the presence of a boolean return type should help with
that. (That is, if you write `if foo.ok() { ... }` the compiler will
catch it readily enough)

Some of the methods on `Result`, however, can't be implemented in
terms of this approach. For example, `chain` and `chain_err` really
need to keep the `Result` return type. But I guess that's clear
enough.

One specific comment on your message:

> - There was talk about making `Result` use an `~Error` trait object
> instead of a generic type `E`, which could invalidate most of this
> email.  However, this could also just mean that you usually will see
> `Result<T, ~Error>` in the wild, for which this proposal still
> applies.  Additionally, even if the Pattern becomes useless for
> Result, the problem still exists for any other newtype variant
> enums, so I'd like to see it get used anyway.

It is not clear to me why moving to a `~Error` object would have
any effect on this proposal. `err()` would just return `Option<~Error>`
in that case, right?


Niko
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to