by hackandtrip · 4y ago · 0 comments
0: https://www.greenbird.com/news/railway-oriented-programming-....
https://fsharpforfunandprofit.com/rop/
And his 'Against Railway-Oriented Programming':
https://fsharpforfunandprofit.com/posts/against-railway-orie...
if a is None:
raise Exception()
if a.b is None:
raise Exception()
if a.b.c is None:
raise Exception()
One of the advantages of Python/Typescript style type hinting is that it avoids the mega-nested `if`s that you often have to resort to in Rust. In Rust the above would not work: if a.is_none() {
bail!();
}
if a.b. // nope! a is still Option<>.
It may be possible to fix that when enum variants are distinct types but as it stands you often have to do lots of indenting.Imagine a code without `if result is not None` basically!