On Jul 4, 2009, at 9:40 PM, WT wrote:
In general, this is not recommended.
If you manipulate an instance variable anywhere other than in an initialiser or a dealloc method, you should use a suitable accessor method.

- (void)viewDidLoad
{
  id anObject = [[NSObject alloc] init];
  [self setMyObject:anObject];
  [anObject release];
}
There is plenty of Apple sanctioned code that does not follow that recommendation, both in sample code and in documentation.

Where instance variables are set without using accessor methods, this should be regarded as a bug in the documentation or sample code and reported.
Use of accessor methods is described plainly here:
<http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmPractical.html#//apple_ref/doc/uid/TP40004447-SW4 >


Indeed. That's the problem with copy/paste and doing things in Mail, rather than from real code, ie, sometimes we all make silly mistakes. Not an earth-shattering mistake to make in this list, though, since you get a warning when trying to compile without the call to super.
[...]
I think everyone understood what I meant. Sometimes I mess up because of genuine confusion on my part and sometimes I mess up because of multitasking. This time it was the latter.

These are two fundamental errors in a reply to a basic question about the fundamentals of memory management.

"As I've said on a previous occasion, over the decade and a half, I've
come increasingly to the opinion that many of the problems that people
have with memory management are not with the Basic Rules -- if they
find and read them, then people can usually understand and apply them
readily enough -- but with incomplete, inaccurate, and misleading
explanations of memory management given by their peers..."
<http://www.cocoabuilder.com/archive/message/cocoa/2008/12/26/226296>

mmalc

_______________________________________________

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