hello,

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.

I could imagine something:
- (id) layerInstance {
        if ([[layerInstancesController selectedObjects] count] > 0) {
                return [[layerInstancesController selectedObjects] 
objectAtIndex:0];
        }
        return nil;
}
to look like:

- (id) layerInstance {
        @try {
                return [[layerInstancesController selectedObjects] 
objectAtIndex:0];
        }
        @catch {
                return nil;
        }
}

it should run faster if I do not have the if clause? Or are there any drawbacks?

Regards
Georg
_______________________________________________

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