Hi,
I just spent few hours and finally understand the two memory
management methods. I think the the pair just do not make sense (or
conceptually illogic). I feel it would be better if NSObject has two
other methods:
-(void) retain:(id)obj;
-(void) release:(id)obj;
In the dog and leash analogy suggested in the Aaron Hillegass's book,
it's the owners of the dog retain or release the dog, but in object-c
the dog has to release/retain itself.
The real advantage of the idea is when using NSAutoreleasePool. It
would be conceptually simpler and more consistent than autorelease
method. We even don't need this method any more. Just alloc/init an
autoreleasepool and it again has the retain:(id)obj and release:
(id)obj methods.
How do you think? Please correct me if I failed to capture something
behind the design. Thanks
Linan Wang