On Oct 17, 2008, at 10:47 PM, Ignacio Enriquez wrote:

I'm starting to think that you should avoid declared properties and dot syntax for now. With some of the newer features of Objective-C and Cocoa, it can be helpful for novices to first become proficient with the "old way"
so they understand the details which are hidden by the "new way".
In other words, perhaps you should get comfortable writing your own
accessors instead of letting Objective-C synthesize them for you. And you should explicitly invoke them throughout your code, rather than blindly
coding without understanding what's happening (with dot syntax, for
example).

just to confirm...
(from 
http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_6.html#)

// assign
property = newValue;

// retain
if (property != newValue)
{
   [property release];
   property = [newValue retain];
}

// copy
if (property != newValue)
{
   [property release];
   property = [newValue copy];
}

So retain is more or less what I want.

Is it? In your original message, you had properties of NSString and NSNumber type. It is much more likely that, with those and other value types, that you'd want to copy.

 this means that instead of
writing getters and setter  methods  I can write
@property(retain) myproperty
and then in the implementation part
@synthesize myproperty
and I should have the same result to the above retain regarding code.
is this ok?

Yes. Declared properties and their synthesized accessors are mostly just ways to automate generation of the classic accessors. (And dot syntax is just a way to generate calls to those accessors.) So, if you understand the way the accessors work and you know which one(s) you want, then, yes, feel free to use declared properties and dot syntax.

Cheers,
Ken

_______________________________________________

Cocoa-dev mailing list ([email protected])

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