Hello!
Today, hwaara, jfrancis, jkeiser and I had a discussion on IRC about
CIDs versus Contract IDs. We were not sure how they relate to each
other. Some questions came up:
<akk> jkeiser: I was explicitly told NOT to put my contractid string in
the idl file.
<jkeiser> akk: where were you told to put it?
<akk> jkeiser: In the .h file for the implementation.
<akk> biesi: Yes, but it's not where we're supposed to look for it
because the official policy (I was told) is not to put it there.
<jkeiser> akk: that depends on what kind of interface / class you are making
<jkeiser> akk: if it's something where you don't really give a crap
which implementation you use as long as you get one, it's OK to define
the contract ID in the .idl
<jkeiser> akk: if there are multiple concrete implementations and you
want the programmer to think about which one to use, then you dump it in
the implementation .h
So... is there really an "official policy"? Is it written down in some
document, describing when to put Contract IDs in .idls, and when not?
If not, wouldn't it be a good idea to create one?
The discussion continued on CIDs versus Contract IDs, I'll summarize it:
jfrancis was of the opinion that CID and Contract ID have pretty much
the same purpose - both identify an implementation of a well-known
interface.
hwaara and I, on the other hand, were of the opinion that a CID
identifies a specific class, while a Contract ID identifies, well,
adherance to a given Contract. (possibly implemented by multiple
classes, each one with a different CID).
So the question:
Who is right? Should CIDs still be used in new code?
And shouldn't there be a document somewhere on mozilla.org describing this?
--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
-- Benjamin Franklin