[webIDL] nullable interface types

WebIDL currently states that an interface type is:
        A scoped name that resolves to an interface is used to refer to
        a type that corresponds to the set of all possible references to
        objects that implement that interface, *plus the special value*
        null, which indicates no object reference.
http://dev.w3.org/2006/webapi/WebIDL/#idl-interface [emphasis mine]

As a consequence,
        It is not possible to have a type Node?, since interface types
        already allow the null value. 

I think it is rather counter-intuitive that
 boolean foo(MyGreatInterface bar);
already allows 

In practice, I discovered this aspect of WebIDL only because the WebIDL
checker is choking on similar constructs e.g. on the Contacts API:
        PendingOp find (in ContactProperties filter, in
        ContactFindSuccessCB successCB, in optional ContactErrorCB?
        errorCB, in optional ContactOptions options);

Arguably, this is something that can be fixed in the Contacts API, but
before submitting the bug report, I was wondering what was the rationale
for forbidding the use of "?" on interface types; in particular:
• why interface types include the null value?
• why is it forbidden to make nullable a type that already includes the
null value?

(I'm sure my questions are naive, but I'm not sure where to look for
answers to them)


Received on Thursday, 28 January 2010 18:43:22 UTC