• 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: Sensible way to extend base class?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sensible way to extend base class?


  • Subject: Re: Sensible way to extend base class?
  • From: Greg Parker <email@hidden>
  • Date: Wed, 20 May 2009 13:35:20 -0700

On May 20, 2009, at 6:01 AM, Ken Thomases wrote:
It's possible for a category to provide ivar-like functionality. You can maintain a "category variable" in the same manner as one implements a "class variable" in Objective-C: a file-scope static in the implementation file. That variable could be a mapping from A instance pointers to a value (or dictionary of values).

It's non-trivial, though. You have to take care of thread safety in maintaining the mapping.

It's also much harder under GC. The "obvious" solutions either leak (because the global table keeps stuff alive), or are thread-unsafe (because no amount of locks can save your dangling pointer if the collector decides to delete the object).


SnowLeopard adds machinery that can be used to do exactly this. Stay tuned.


-- Greg Parker email@hidden Runtime Wrangler


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Sensible way to extend base class?
      • From: Michael Ash <email@hidden>
References: 
 >Sensible way to extend base class? (From: Graham Cox <email@hidden>)
 >Re: Sensible way to extend base class? (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Network Reachability APIs
  • Next by Date: Re: Network Reachability APIs
  • Previous by thread: Re: Sensible way to extend base class?
  • Next by thread: Re: Sensible way to extend base class?
  • Index(es):
    • Date
    • Thread