By the way, I posted on the GOLang list a while ago my suggestion for error handling. It's like exception handling, but it's all done through function calls, (no try catch and jumping forward). Example:
ret, e = _some_function()
# e is non-null if an exception/error happened
ret = some_function()
# on error, an exception is raised and caught by the first parent function that used _call() syntax (leading underscore)
So basically, _func() means call func(), and have an extra return value that is an exception or Null if no error. All one has to implement is either a _func or func, not both, the compiler handles the conversion.
So bottom line, you can write real exception safe code and not have to worry about a panic/exception breaking the flow, by using _func() calls, or you can bail by using func() calls, it's your choice.
edit: not sure how this ties in to RAII, if at all. Guess I should get back to the drawing board... :-)
ret, e = _some_function() # e is non-null if an exception/error happened
ret = some_function() # on error, an exception is raised and caught by the first parent function that used _call() syntax (leading underscore)
So basically, _func() means call func(), and have an extra return value that is an exception or Null if no error. All one has to implement is either a _func or func, not both, the compiler handles the conversion.
So bottom line, you can write real exception safe code and not have to worry about a panic/exception breaking the flow, by using _func() calls, or you can bail by using func() calls, it's your choice.
edit: not sure how this ties in to RAII, if at all. Guess I should get back to the drawing board... :-)