On 14 Aug 2008, at 8:58 pm, Georg Seifert wrote:

is it recommended to use @try .. @catch blocks as flow control like it is used in Python. They say explicitly to use it rather than do a lot of test before just try if it works to look after it only if it fails.


Hmmm, I'll be looking forward to the replies to this question!

My view is absolutely NOT to use try/catch for flow control. They were invented to handle exceptional conditions, and that's what they should be used for. They are not a substitute for proper conditional clauses and properly structured code. I believe the Python advice (which I take at face value, not being familiar with Python) is misguided at best, though may suit that language better. Also, my understanding is that while a try block is very cheap, the catch block is not. Since they are only expected to be run once in a blue moon, that's reasonable, but if they are used routinely, performance is likely to suffer.

cheers, Graham
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to