On 2011-06-29, at 18:09 , Matt Neuburg wrote:

> As I said then, "Ownership is *never* something you are magically given.

Since when do you have to be owner of an object to be allowed to interact with 
it? 
This contradicts pretty much everything Apple has ever documented about 
Cocoa/Obj-C.

Following your reasoning, Apple has to re-design Cocoa and re-write all guides 
and sample code, since no method should ever return a retain+autorelease 
result, instead all code must always follow the (currently inexistent  rule): 
"An object returned by another object is only guaranteed to live as long as the 
object lives that returned it. To extend its lifetime you always have to retain 
the object".

Right now this is only the case for collection classes and it is in fact *so 
special* that Apple *explicitly* points out this fact in their documentation. 
And to be honest, Apple only implemented them that way for performance reasons 
- if retain+autorelease was pretty much for free, I bet Apple had even used 
that for return values of collection classes; since that is what they do for 
pretty much all other classes. E.g. the "description" method of an object 
always returns a NSString that will for sure stay alive, even if you kill the 
object after calling "description" on it - I have never seen an implementation 
of description which hasn't. Nobody would seriously consider retaining this 
string.

However, you are also missing my primary point: I have no problem with the fact 
that an object won't live longer than it's "parent"; this is just something 
that "nonatomic" doesn't tell me. Nonatomic tells me that the operation is not 
atomic, fine, but I don't expect it to influence object live duration; those 
are two completely different things not related to each other. Also it's pretty 
much funny how both answers I received so far concentrated on this remark, but 
none of them answered a single of the various questions I have asked in my mail 
(and *THOSE* were my primary points). Now that I have learned what nonatomic 
means to retain properties, it would be nice to know what nonatomic means to 
"assign" and "copy" properties for example.

Kind regards,
Markus_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to