Hi Quentin, Banlu, On Wed, Jun 27, 2012 at 4:43 PM, Quentin Mathé <[email protected]> wrote:
> Hi Banlu, > > Le 26 juin 2012 à 00:32, Al Chemyth a écrit : > > > Hello, > > I have several frameworks that I want to register their UTI using > +initialize for each class but I have a problem that the parent class type > may not already be +initialize'd and so I need to manually call [aClass > class] to activate their +initialize's. > > When a class receives +initialize, the runtime ensures its superclasses > have received +initialize. See +[NSObject initialize] doc on Apple website. > You might have stumbled on a runtime bug here. > > The reason that they didn't receive +initialize in order because they aren't subclassing each other. eg. A : NSObject and B : NSObject and B depends on A's initialize to register the type. > > This is a little inconvenience as it must know exactly what class was > responsible for a needed supertype hence it will break the encapsulation of > the framework that is responsible for the supertype registration. In the > case that the supertype registrations can be guaranteed to be initialized > at some states in the application, would it be convenience to allow some > temporary supertype registration that would just raise exceptions by > default but to be replaced by real registrations later? (I could also just > add some per-frameworks global functions to encapsulate the initializations > though) > > As an alternative, if you are writing an application, you can declare your > UTIs in a UTIDefinitions.plist and UTIClassBindings.plist that belong to > the application resources. See the ETUTI class documentation for more > explanations. > For the plist format to be used in UTIDefinitions.plist and > UTIClassBindings.plist, check EtoileFoundation, its resources include the > built-in UTIs in such plist files. > > To support the same mechanism for frameworks, I could add a method +[ETUTI > registerTypesForBundle:]… You would just have to call this method with your > framework bundle once it it's loaded. > It might even be possible to enumerate the currently loaded frameworks in > +[UTI initialize] and handle that transparently. > I'd prefer this +[ETUTI registerTypesForBundle:] method and auto handling sounds great. Thank you very much, Al. > > Cheers, > Quentin. > > > > _______________________________________________ > Etoile-discuss mailing list > [email protected] > https://mail.gna.org/listinfo/etoile-discuss > -- I used to be a GNUstep developer like them, then I took an arrow in the knee...
_______________________________________________ Etoile-discuss mailing list [email protected] https://mail.gna.org/listinfo/etoile-discuss
