|
|
|
|
|
by Animats
3629 days ago
|
|
The idea that each type has its own control flow primitives is bothersome. It's taken over Rust: argv.nth(1)
.ok_or("Please give at least one argument".to_owned())
.and_then(|arg| arg.parse::<i32>().map_err(|err| err.to_string()))
.map(|n| 2 * n)
I'm waiting for date.if_weekday(|arg| ...)
Reading this kind of thing is hard. All those subexpressions are nameless, and usually comment-less. This isn't pure functional programming, either; those expressions can have side effects. |
|
This has not "taken over" rust. Result is another type that does this, but this makes sense for the same reasons.