Re: Objective 2.0 properties
Re: Objective 2.0 properties
- Subject: Re: Objective 2.0 properties
- From: Nathan Day <email@hidden>
- Date: Fri, 17 Oct 2008 14:17:30 +1100
And because they are immutable types, if they are mutable then retain
is probable the appropriate behaviour. Copy will become retain for
truly immutable objects and if you get a subclass that is mutable then
you don't want that changing under you so copy gives you a new
immutable version.
Assign really is not the right thing to do in this situation, what is
to stop lessonDuration from disappearing underneath you. If you are
trying to stop circular retains then assign is what you use, for
example a container object retains its children, the children should
not retain the parent.
On 17/10/2008, at 14:02 , Charles Steinman wrote:
@property (nonatomic, retain) NSString* lessonTitle;
@property (nonatomic, retain) NSDate *referDate;
@property (assign) NSNumber * lessonDuration;
Why is lessonDuration assign? That's begging for a crash. All three
of these should be copy since the classes all conform to NSCopying.
Nathan Day
email@hidden
http://homepage.mac.com/nathan_day/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden