> It'd be much like creating an instance and then calling
> object.Init("one", "two");

what i dislike here is: if my object somehow depends on Init() being
called once (and maybe only once) before any other method
is invoked upon in, i have to include check-initialized-or-throw
code in _every_ method - well, in the end, isn't this exactly
one of the problems constructors solve?

--------

ok, what about this: i "misuse" the "nsISupports aOuter" parameter in
nsIFactory.createInstance() which normally supports aggregation to
pass in information at construction time:


nsIMyInfosForTheConstructor* info;
..
nsIMyObject ... = blah->createInstance(info, ...)

Is there any problem in doing so?

----------

it seems, once there was a way to write factories consuming ContractIDs:

http://lxr.mozilla.org/seamonkey/source/xpcom/components/nsObsoleteModuleLoa
ding.h#10

10 extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* aServMgr,
11                                            const nsCID &aClass,
 12                                            const char *aClassName,
 13                                            const char *aContractID,
 14                                            nsIFactory **aFactory);


its not possible anymore, as i see:

http://lxr.mozilla.org/seamonkey/source/xpcom/components/nsIModule.idl#63

63     void getClassObject(in nsIComponentManager aCompMgr,
 64                         in nsCIDRef aClass,
 65                         in nsIIDRef aIID,
 66                         [retval, iid_is(aIID)] out nsQIResult aResult);

...
extern "C" NS_EXPORT nsresult PR_CALLBACK NSGetModule(nsIComponentManager
*aCompMgr,
                                          nsIFile* location,
                                          nsIModule** return_cobj);







Reply via email to