On Wed, 29 Jun 2011 12:53:26 +0200, Markus Hanauska <hanau...@equinux.de> said:
>E.g. consider the following code:
>
>       ObjectCreator oc = [[ObjectCreator alloc] init];
>       id value = [oc value];
>       [oc release];
>       [value someMethod];
>

We actually had something very like this discussion here already recently:

http://lists.apple.com/archives/cocoa-dev/2011/Mar/threads.html

(Look at the thread titled "NSAttributedString crashes".)

As I said then, "Ownership is *never* something you are magically given. It is 
always something that you must take if you want it." Perhaps that answer isn't 
very satisfactory, but at least it provides a philosophy that covers the case. 
As Andy Lee says in that same thread, "We've been conditioned to think we have 
"extra persistence time" at least up to the next run loop iteration," but (I 
think he's implying) this conditioning is specious and serves only to make us 
lazy. To put it another way: ObjectCreator's "value" method is opaque; to 
pretend that you *know* its memory-management policy is really just a case of 
programming by guesswork. m.

--
matt neuburg, phd = m...@tidbits.com, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook_______________________________________________

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