Message from JavaScript discussions

February 2019

— Int a(value * v) {
*v = real return value;

return errcode;
}

— 

Or .. you can return also a struct with all error data (via a pointer from the arguments) and just return 0 on1, not the errcode directly in the return

— Int a(value * v, err * e) {
*v = real return value;

*e= error if any;

return 0 or 1;
}

— 0 means OK

— You can also use setjmp if you want to emulate exceptions

— C is very limited in comparison to c++ or js

— Here error can be a code or a struct

— Makes sense

— Like a monad without the abstraction

— What abstraction do you mean?

— With monads, you don't have to check for error

— You just do the operation on the result