On 12/07/2013 01:55 AM, Simon Sapin wrote:
On 07/12/2013 00:49, spir wrote:
About the latter, in particular it should be obvious in code, without knowledge
of language arcanes or weird idioms, that (or whether) the caller expects a
success unconditionally -- because (and in other words that) the anomalous case
just does not belong to this app; this is critical information to the reader.
How to do that right?

If my proposal is accepted (returning Option is favored), then calling .unwrap()
is the way to express that success is expected. unwrap() causes task failure
when called with None.

Maybe it's only me, but this not at at all clear to my eyes. My imagined soluton (for a totally different lang) was something like this, on the caller side:

        ucodes = s.utf8_decode()!       // source should be correct, error on 
failure
ucodes = s.utf8_decode()? // logical failure expected, return None or whatnot

(But maybe _this_ is obscure to your eyes?)

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

Reply via email to