• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Accessors (can we close it this way?)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessors (can we close it this way?)


  • Subject: Re: Accessors (can we close it this way?)
  • From: Marcel Weiher <email@hidden>
  • Date: Wed, 7 Aug 2002 17:34:08 +0200

Ondra,

no way can we "close" it this way, because you have just reasserted various things that simply aren't true.

1. Performance (This was probably just a typo, but it is still wrong)

It is the "[[var retain] autorelease]" method that is ten to forty ( 10-40 ) times slower than the "plain" method. Now I don't know about the rest of you, but a factor 10 (ten!) performance difference is something I consider rather significant.

2. "Vendor's Responsibility"

Even if Cocoa, as Ali says, tries to maintain this contract "most" of the time (and he does say "most" not "all") as a convenience, it is NOT a required contract. Quite the contrary. Check out the documentation on your hard disk:

file:///Developer/Documentation/Cocoa/TasksAndConcepts/ ProgrammingTopics/MemoryMgmt/index.html

Scroll down to "Validity of Shared Objects"

"Cocoa's ownership policy limits itself to the question of when you have to dispose of an object; it does not specify that any object received in a method must remain valid throughout that method's scope."

That is a direct quote from the documenation.

So your claim on this is plain and simply wrong.

3. "Inherently-unsafe"

This is simply false. There is nothing *inherently* unsafe about

id o = [someObject o];

.. do stuff ...

[o doStuff];

It is only "unsafe" if you manage to somehow release 'o' in the meantime. Contrary to your claims, this (a) rarely happens in the first place and (b) is easy to detect if it does happen, usually straight in the code.

If your code (a) does this a lot and (b) makes it difficult to detect, you should think about your code some more.

Marcel

--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Accessors (can we close it this way?) (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: Accessors (can we close it this way?)
  • Next by Date: Re: iTunes programming
  • Previous by thread: Re: Accessors (can we close it this way?)
  • Next by thread: Re: Accessors
  • Index(es):
    • Date
    • Thread