On Jun 29, 2009, at 3:50 PM, Yossef M. wrote:
Maybe I’m misunderstanding the point of the ‘else’ clause, but
wouldn’t you put code that “only gets executed if none of the rescue
clauses are (i.e., there is no exception)” in the main body of what
you’re adding rescues to? (viz. begin block, method definition)
If there is something that isn’t valid in the face of an exception and
for which you do not want to catch any exceptions, but must occur
prior to the ensure block.
rescue => ex
If doing d is only valid if b completes, and assuming that (x) means
an exception happens during x, the possible sequences are:
Note that d happens before e, but (d) does not cause the rescue clause
to be invoked.
I know that I’ve run into the practical need for this at least once
(but there were several rescue clauses, not just one). If I could
recall the specific example, I’d have put it in.
Rob B. http://agileconsultingllc.com