• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Objective 2.0 properties
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Objective 2.0 properties (From: Charles Steinman <email@hidden>)

  • Prev by Date: Re: Objective 2.0 properties
  • Next by Date: Re: Object is not reachable from this managed object context
  • Previous by thread: Re: Objective 2.0 properties
  • Next by thread: Re: Objective 2.0 properties
  • Index(es):
    • Date
    • Thread