On May 22, 2008, at 10:43 AM, Greg Titus wrote:


On May 21, 2008, at 12:37 PM, Johnny Lundy wrote:

This is just one example of that "little tidbit" that is always left out of these references by Apple. It seems to be the <.O. for some reason. The "tidbit" isn't some extraneous bell or whistle; it's always something fundamental.

They can't take 2 lines instead of 1 to document the behavior of a class method?

A lot of people have already mentioned that the memory management semantics for these methods are the same everywhere and are described in the conceptual documentation. I'd like to answer the obvious follow up question: even if it is described in the concept docs, how would it hurt to repeat it in the NSArray class method references? It is just one more line...



But it's not just one more line - it's like a dozen or so (to handle the whole semantics of the memory management, not to mention the whole GC vs no GC), and it would be the same dozen lines in hundreds of different methods.

Even if you tried to shorten it up, say, to just make sure that it "returns an autoreleased object" that would still require the reader to understand what that means (so if you can shorten it up to just that, why do you need it there at all? Alternately, if you need to explain that the object is autoreleased, why don't you have to explain what that means?). Worse, that isn't even accurate - you don't care if the object is autoreleased or not (it may, for example, be a singleton that is never actually released - for example [NSNumber numberWithInt: 0] will return the same value every time you call it - the result isn't autoreleased).

You need to understand what to do with regards to memory management in the first place to be able to act appropriate to understand what it means if the document says "returns an autoreleased object", and if you understand the memory management, you don't need to know if it returns an autorelased object or not. You understand the rules, and then you know what you need to do with the object.

My experience when I first learned it was that I tended to try to over- think the situation. Once I realized that it really was as simple as it seemed, it all just clicked.


Glenn Andreas                      [EMAIL PROTECTED]
 <http://www.gandreas.com/> wicked fun!
m.o.t.e.s. | minute object twisted environment simulation



_______________________________________________

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