On Jan 25, 2016, at 10:48 , Dave <d...@looktowindward.com> wrote:
> 
> myNewObject = [super initWithSomething: something];

This is a dangerous thing to do. At this point ‘self’ might not be a properly 
initialized object, if the ‘super’ call returns a different object from ‘self’. 
You’re better off assigning the result to ‘self’ as usual.

>       [LTWCacheManager addToCache: myID];

Huh? You’re not passing the object being cached, so how can you get it out of 
the cache again later? If the ID is a string that contains the object pointer, 
then at the very least the object isn’t being retained by the cache, is it?

>       self = myNewObject;
[…]
>       return self;

> self = myCachedObject;
> return self;

These aren’t really meaningful. Assigning to ‘self’ doesn’t really achieve 
anything, other than the possibility of getting it wrong. If you want to return 
an object other than self, then just write ‘return myNewObject’ or ‘return 
myCachedObject’.

_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to