John Bandhauer wrote:
> pete pete, why do you set yourself up for such abuse?
Thats exactly why i picked up the bat phone to call Jband.
Unfortunately, the only way i seem to understand something completely is
through a great deal of self abuse. I really do wish there was another
way though . .
> - Why the heck would you want to do this?
Because, right now i already have functions that return the ClassID and
progID for an interface. I think it would be cool to be able to pass a
progID or classID to a function and get back the interface.
> - Isn't creating an instance of a service a pretty major
> non-obvious side effect?
It certianly is. I was hoping to use equals to find the match but
haven't been successful.
> - Why get the service over and over again in the loop rather than
> getting it first and loop over calls to QI?
Because it was late when i was doing it.
> - What if the service implements many interfaces?
Then it would be nice to know what they are.
> - What if the for-in loop happens to give you nsISupports before
> any other match? i.e. if nsISupports happened to be the first
> thing in the list then if would *always* be the result of this
> call. No?
Yes, i've already seen that happen. But that can obviously be removed
with a conditional.
> - Your function has paths that don't return a value.
My function obviously isn't finished. ;-)
> - Could "for(list in i)" be any less intuitive? :)
Not for a test draft of the function. No.
for(list in interfaces)
could make one warm and fuzzy though, right?
I will with-hold any comments i have reguards using the words intuitive
and xpcom in the same sentence.
;-)
--pete