It would need a red mark because *one* convenience method doesn't provide the full error handling suite?? Surely Rust at least gets "Some".

That said, the failing-reader and/or `operate` techniques sound like they might be nice, on first blush. (I'll note that `operate` is very similar to the "conditions" we used to use for all IO errors.)


Huon

On 19/02/14 20:32, Lee Braiden wrote:
On 19/02/14 09:14, Phil Dawes wrote:
I understand, but it seems like a bad tradeoff to me in a language with safety as a primary feature. '.lines()' looks like the way to do line iteration in rust, so people will use it without thinking especially as it is part of the std.io <http://std.io> introduction.


I agree. IO is certainly an area where you want to know that ALL errors are propagated upwards. Even with the best of intentions, it's very easy to write IO functions that handle 20 cases, across 5 levels of abstraction, and inadvertently not handle all failure conditions for one particular case. It may not even matter for the purposes of the original code, but can later bite you pretty hard, when you come to add functionality, and find that something is missing from your API to handle the more general case correctly.


At the moment, Rust would have to get a red mark on this table:

http://en.wikipedia.org/wiki/Comparison_of_programming_languages#Failsafe_I.2FO_and_system_calls

Which would be quite sad, considering its goals.


IMO, this should be acknowledged as the simple oversight that it is, and fixed.


--
Lee



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

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

Reply via email to