Out of curiosity, how would you recommend handling a situation in which a file close fails? My instinct is to have an RAII class whose destructor catches any exceptions, adds the error to some list somewhere, and doesn't rethrow anything.
What's an example of a language you like that does exceptions in a better way?
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... :-)
Like everyone, I'm still waiting for the perfect language. That said, due to this issue and the fact that writing exception safe code in c++ scares me (due to having datastructures potentially being in a wierd state), I have never used exceptions in c++.
I'd like to try c#, to see if it has the power of pythons unchecked exceptions and with blocks but with more helpful static typing for more 'mission critical' stuff, but I'm quite torn because as my name suggests, I like working on linux...,
What's an example of a language you like that does exceptions in a better way?