return in loop for ?
mwm at mired.org
Thu Nov 24 18:19:14 CET 2005
Roy Smith <roy at panix.com> writes:
> In any case, in a language which has exceptions, it's almost impossible to
> really have true SESE, since an exception could be thrown from almost
> anywhere. To be fair, there are those who use this to argue that
> exceptions themselves are a bad thing. In my last job, the official style
> guide said to not use exceptions in C++ because they generate confusing
> flow of control, but I think that's becomming the minority view these days.
I really like Eiffel's model of exception handling. Instead of having
the ability to catch exceptions at arbitrary points in your code -
which, as you point out - can lead to confusing flow of control - a
function can have an exception handler - a "retry" clause - that
handles all exceptions in that function. Further, the retry clause
does one of two things: it either starts the function over again, or
passes the exception back up the chain. I'm not sure that it stacks up
on the practicality scale, but it certainly leads to a more
comprehensible program when you are dealing with lots of exceptions.
Mike Meyer <mwm at mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
More information about the Python-list