On 3 Apr '08, at 7:50 PM, Dmitry Markman wrote:

1. I read all that documentation, please, enough about that, really

Reading it isn't enough, you have to _understand_ it. I know that sometimes it can take several readings before something makes sense. Usually after you've been burned by mistakes, it suddenly becomes clearer on the next reading :)

2. I should follow the "alloc, new, copy or mutableCopy" rule. I should note that I'm talking about creation methods not create/copy/get methods all of that
   notes about looking to the name (what in your name :-))  )
3. but I agree with Adam comment that the rule isn't 100% reliable and therefore isn't good enough

Err, it's been good enough for me for seven years and counting. I didn't see Adam say anything about rules not being good enough.

Methods that return objects either "give you a reference" that has to be released later, or they don't. You can tell from the name of the methods which ones they are. In the great majority of cases, the methods you call don't require you to deal with releasing the object.

The fact that there are autorelease pools is mostly an implementation detail. The fact that an object without 'alloc' or 'copy' in its name returns an object doesn't mean it autoreleased that object. The object could be an instance variable belonging to it, for example. It doesn't matter to you.

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to