W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2010

[webIDL] nullable interface types

From: Dominique Hazael-Massieux <dom@w3.org>
Date: Thu, 28 Jan 2010 19:43:12 +0100
To: public-script-coord@w3.org
Message-ID: <1264704192.14141.1000.camel@localhost>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:02 UTC