From: Neil M. <ne...@cs...> - 2006-11-03 11:57:55
|
On 3 Nov 2006, at 08:44, Eckhard Lehmann wrote: >> Just an endorsement to this... You wouldn't implement a procedure >> this way in practice. > ^^^^ > >> Why? Because you can't debug it with *any* method - it is useless >> here to catch the error just to rethrow it at a different place. >> The only good reason to catch an error and rethrow it is to do >> some special processing *immediately* - e.g. > > Ahhmm I should have seen that [using] actually *does* this kind of > special processing (by closing the $chan no matter if error or > not). My fault, the above marked was a wrong statement... sorry. > > But the point stays the same. Actually, as the author of [using] and several other control constructs, I can say that you definitely do end up catching everything just to rethrow errors again. Apart from being essential in order to clean up resources (i.e., equivalent of a "finally" clause), it is also necessary if you want to catch "break" or "continue" exceptions. This isn't some obscure corner case: any time you want to [catch] anything you have to catch everything and then rethrow those exceptions you don't know how to deal with. -- Neil |