Re: Objective 2.0 properties

2008-10-18 Thread Jim Correia
On Oct 17, 2008, at 2:29 PM, Jim Correia wrote: For object types, in a non-garbage collected application (traditional retain/release style memory management) you never want to use assign. It is the equivalent of hand writing an accessor that does a pointer assignment (with no additional

Re: Objective 2.0 properties

2008-10-17 Thread Ignacio Enriquez
Thanks for your responses. Chuck: First : I used assign in order to be taught about it, actually I have never explicitly used. but As far as I know assign is the default so implicitly I have used it. with out problems. Second: Let me see If I understood. they should be copy since all the classes

Re: Objective 2.0 properties

2008-10-17 Thread Jim Correia
On Oct 17, 2008, at 1:25 PM, Ignacio Enriquez wrote: Second: Let me see If I understood. they should be copy since all the classes all conform to NSCopying. this means that all (and I mean ALL ) properties should be copy?? (since all objects inherits from NSObject and this class conform to

Re: Objective 2.0 properties

2008-10-17 Thread Ignacio Enriquez
I think I am beginning to understand this. What gives you the impression that NSObject (and thus all of its subclasses) conform to NSCopying? I think I was wrong... I will read the documentation about this. A property should be copy when you are interested in the *value* of the thing being

Re: Objective 2.0 properties

2008-10-17 Thread Jim Correia
On Oct 17, 2008, at 1:59 PM, Ignacio Enriquez wrote: I think I am beginning to understand this. What gives you the impression that NSObject (and thus all of its subclasses) conform to NSCopying? I think I was wrong... I will read the documentation about this. A property should be copy

Re: Objective 2.0 properties

2008-10-17 Thread Charles Steinman
--- On Fri, 10/17/08, Ignacio Enriquez [EMAIL PROTECTED] wrote: Regarding former responses... aObject.property is like using getter and setter methods (depending on the situation) and just property is going directly to the property ... Did I get it right? if so, why using setter methods

Re: Objective 2.0 properties

2008-10-17 Thread Ken Thomases
On Oct 17, 2008, at 12:25 PM, Ignacio Enriquez wrote: Thanks for your responses. You're welcome. First: self.property is only or reading right? No. self.property may be used either to get the value of the property or, as the target of an assignment statement, to set the value of the

Re: Objective 2.0 properties

2008-10-17 Thread Ignacio Enriquez
Ken: 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

Re: Objective 2.0 properties

2008-10-17 Thread Ken Thomases
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

Objective 2.0 properties

2008-10-16 Thread Ignacio Enriquez
hi everyone! I have a problem that is taking me hours of debbuging time. So I decided to learn the origin of the problem. It's about properties (Objective C 2.0) As you know there are some kinds of properties (nonatomic, retain,asign, readonly, readwrite... etc) Let's thinks the next case :

Re: Objective 2.0 properties

2008-10-16 Thread Charles Steinman
--- On Thu, 10/16/08, Ignacio Enriquez [EMAIL PROTECTED] wrote: @interface Lesson : NSObject { NSString *lessonTitle; NSDate *referDate; NSNumber *lessonDuration; } @property (nonatomic, retain) NSString* lessonTitle; @property (nonatomic, retain) NSDate *referDate; @property (assign)

Re: Objective 2.0 properties

2008-10-16 Thread Ken Thomases
Let's start at the end, where you asked: On Oct 16, 2008, at 9:19 PM, Ignacio Enriquez wrote: So I would like to know the difference between self.property and just property self.property used for reading the property value (as opposed to setting it) is exactly equivalent to [self

Re: Objective 2.0 properties

2008-10-16 Thread Nathan Day
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.