On Jul 10, 2013, at 23:26 , Kyle Sluder <k...@ksluder.com> wrote: > It's generally bad form to override a method for the sole purpose of changing > its return type. Just cast the returned value got the appropriate type.
The trouble is that a cast is (generally) a bug waiting to happen, because it masks the type being cast from. There's really no unobjectionable solution, so it's a matter of preference which good form gets violated. On Jul 10, 2013, at 23:58 , Tom Davie <tom.da...@gmail.com> wrote: > Except that view is a read/write property, and this is a type error, because > of this situation: > > UIVCSubclass *s = [[UIVCSubclass alloc] init...]; > UIViewController *vc = s; > [vc setView:[[[UIView alloc] init] autorelease]; It's not a practical problem for NSViewController, because the view is normally only set at loading time, and there's no verification of the view class at that time anyway. In the unlikely event that code like this needed to exist, then it would make sense to override the "view" property setter and check the view class at runtime. _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com