Re: Try/Catch
- Posted by petelomax Jan 02, 2015
- 6287 views
This is not error handling.
if i <= length(s1) and j <= length(s1[i]) and j <= length(s2) and k <= length(s2[k]) then s1[i][j] = s2[j][k] else return false -- oh dear, give up end if
I get it. You are using "error" to mean "fatal error" whereas I am using the phrase "error code" to mean exactly that kind of long-winded and tedious code, which to be fair can itself be a source of unwanted errors. Wanting something neater is fine.
"take action to recover from a exception, and continue normal execution"
Sure. But we ought to be cautious about over-selling this as some easy panacea. There will be cases where the long-winded and tedious approach turns out to be simpler, in the long run. We must still give a user an adequate warning about saving a possibly corrupt document even if it is annoying. Doing and saying nothing can be even more annoying than an abrupt crash. If there is a nasty bug that causes our program to quietly go bananas in the field, we still need to know about it. And so on.
cleanup(handle), or as below
I'm not sure what cleanup is defined as doing. Is this something you're proposing, or is already in Euphoria?
Oh, I just meant any-named user-defined routine with whatever parameters you might want or need containing common code factored out from the try and catch blocks.
PS: I just use italics for emphasis, not irritation.
I thought you were having a dig at my use of italics when I first read that
Pete