News for hackers. Stuff that matters.
Re:If monads are the solution, what is the problem? by CodexArcanum on Monday July 30, 2018 @05:09PM (#17648065)
I hate to be "that guy" but take a look at Rust if you haven't. It's pretty close to C but incorporates a lot of functional-style type magic. Your particular example is very explicitly supported by the `Result` type (which is an error-specific version of Haskell's `Either` type). It also has some syntax sugar and macro usage to make working with error types pretty simple.
Re:If monads are the solution, what is the problem? by tathougies on Monday July 30, 2018 @07:01PM (#17648978)
Rust is great, but not appropriate for my C use case. I did consider it, and would use it for other systems level stuff. This particular project is very close to the metal, and I want to use C and assembler. But yeah, if it was any more complicated, I would use rust. Rust is pretty great.