Hi Marco,

Using your example of locating a spellchecker for use by your
component, that sounds like something the user might want
control over (lots of folks that use spellcheckers often
customize the dictionary to suit their writing style).

If your query for a list of implementations returns one component,
then fine - you silently use it and go on but if the user has installed
some spiffy-keen whiz-bang spellchecker it might not show up
as the first one in your search. Fail to present the user with a
choice (one your program remembers the next time it is
run) and you've prevented them from doing what they want
for a very arbitrary reason. Having the user "pull" out an
unwanted component can cause problems with other dependent
components or even other desired components whose code
happens to reside in the same library as the the unwanted one.

There is nothing wrong with what you are suggesting, just
beware that it can add considerable complexity which the
rest of the XPCOM world has so far managed to avoid.

Having a way to categorize and search components quickly
leads you into the territory of directory services for components
(that's directory as in ADSI or LDAP, not disk file directory).
Queries for what services are available, what categories of
components are available, what remoteable components are
available, etc. become possible.

XPCOM does not offer these services but also does not
prevent you from writing your own. You might want to
consider writing your own component directory service
then the rest of us could request it from the service manager
and use it to browse the installed set of components. FYI,
I'm working on exactly this kind of thing for a corporate
client in an MSCOM environment. All I can say is if you
decide to do this, start small and go from there!

Good luck,
Rick Parrish

Marco Bosch wrote:

> I was thinking more along the lines of Mozilla defining
> for instance a spellchecker interface. Just some interface
> in which you supply a target language and a word and
> the spellchecker will return a list of recommended
> substitutions if it doesn't know the word. Now, if I would
> write a component and I would need a spellchecker,
> I would like to ask the componentmanager if there is
> *any* class implementing that interface. And if so,
> just use the first one available.
> The user could than quite easily remove a certain
> implementation of the spellchecker for another one, without
> me having to put all possible CIDs that could implement
> this interface into my component and check if any of these
> CIDs is available. (And hoping that after I publish my
> component no new spellcheckers come available).
>
> I hope this clarifies my question.
> (BTW: it is only an example)
>
> Greetings,
>
> Marco Bosch


Reply via email to