|
|
|
|
|
by TheDong
2759 days ago
|
|
In many languages invented since c that have errors as values, you can use something akin to a specialized monad to sequence things which may fail together. For example, in rust you could use: let res1 = w.Write(...)?;
let res2 = w.Write(res1)?;
In haskell, you can use do notation or monad binding to do a similar thing.Of course C doesn't have a good type system that allows this sort of thing; it was created before such type systems were well known. I would expect any modern language to at least recognize that there are good ways to sequence and compose types. |
|