Re: OT: Categories and alloc.
Re: OT: Categories and alloc.
- Subject: Re: OT: Categories and alloc.
- From: Edwin Zacharias <email@hidden>
- Date: Sat, 29 Jun 2002 19:29:40 -0400
The goal question: How do you allocate from a protocol/interface?
I only know about ObjC. You implement a plugin based system using
NSBundle where the each plugin lets you know what it can handle. You
can either store this info in the bundle's info file, check the
principle class for a certain protocol, or create some other way. Apple
seems to be moving it's plugin format to a COM style (see CFPlugin) so
you may want to read about how COM does it.
Once you have a list of all the classes that can handle your protocol
you choose one, or let the user choose one, and load the class. Then
use the class to create instances.
Inside Mac OS X: System Overview has some really good info:
http://developer.apple.com/techpubs/macosx/Essentials/SystemOverview/AppPackaging/
index.html
Also read about NSBundle.
I've posted a lot about the lack of protocol support in Cocoa; that
there is no NSCollection (key method: objectEnumerator),
NSIndexedCollection (key method: keyEnumerator), etc.
Abstract classes are for inheriting interface. Protocols are what ObjC
should be using to inherit interface. I have no idea why there's no
protocol for collections, indexed collections, etc. Can someone clue me
in here? Shouldn't we all be using (id <NSArray>) instead of
(NSArray *)?
How do you write something like this so that it's extendable, and works?
I'd like to know this too. This was the goal of ObjC, Eiffel, and a lot
of other languages. Apparently it's extremely hard because these
languages aren't exactly dominating the market.
In answer to your security question. You have none. It's impossible.
Don't bother trying. :-)
See
http://www.stepwise.com/Articles/Technical/Bundles.html for more
good info.
- Edwin
_______________________________________________
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.