On Mon, Nov 11, 2013 at 6:52 PM, Gaetan <gae...@xeberon.net> wrote: > > For instance url.rs. To parse a string, you have to write this: > > let u = url::from_str(urlstring).unwrap(); > > I would propose this solution: > > let u = parse_url(urlstring); > > > => simpler, easier to read, easier to remember ! > Of course, the unwrap thing would still be here. >
Rust generally uses sum types to report errors. The `from_str` method doesn't work for all inputs, so it returns `None` in those cases. The ability to handle errors does need to be there, and forcing a concious decision on how to handle common, easily recoverable errors makes a lot of sense to me.
_______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev