Removing io_error was bad enough, I didn't want to worry too much about naming this macro at the time. The name if_ok!() isn't fantastic, and we should probably rename it.
try!() - short, succinct, but can possibly evoke the notion of try/catch exceptions from other languages
ok!() - also short and succinct, but may not always be clear what it's doing.
if_ok!() - works well for let statements, not always clear what it's doing though.
Some code that I think should be considered when naming this macro:
fn foo() -> io::IoResult<()> {
if_ok!(some_function());
let bar = if_ok!(some_function());
if if_ok!(some_function()) {
// ...
}
match if_ok!(some_function()) {
// ...
}
}
Nominating.
Removing
io_errorwas bad enough, I didn't want to worry too much about naming this macro at the time. The nameif_ok!()isn't fantastic, and we should probably rename it.try!()- short, succinct, but can possibly evoke the notion of try/catch exceptions from other languagesok!()- also short and succinct, but may not always be clear what it's doing.if_ok!()- works well for let statements, not always clear what it's doing though.Some code that I think should be considered when naming this macro:
Nominating.