On 9/29/08 1:35 PM, Ondřej Čada said:
>That might not be true with more complex init. What if init just
>contains
>
>self.someAttribute=-3;
>
>and what if the subclasser completely bona fide prevents negative
>values like this?
>
>@implementation PositivesOnly
>...
>-(void)setSomeAttribute:(int)value {
> NSAssert(value>0,@"For %@ value of someAttribute must be positive");
> [super setSomeAttribute:value];
>}
>
>Then somebody catches the exception, the autorelease pool or GC
>releases the object, and you get your subclassed dealloc without init
>having been finished.
I know the above is an example, but... it is generally preferable to
not use setter accessors in init, it is better to set the ivars directly:
<http://www.cocoabuilder.com/archive/message/cocoa/2008/8/5/214893>
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden