Hi,
Yes, optional and nullable mean different things in Web IDL.
find is specified as follows:
Promise<http://www.w3.org/2012/sysapps/contacts-manager-api/#dfn-promise> find<http://www.w3.org/2012/sysapps/contacts-manager-api/#widl-ContactsManager-find-Promise-ContactFindOptions-options> (optional ContactFindOptions<http://www.w3.org/2012/sysapps/contacts-manager-api/#idl-def-ContactFindOptions> options);
As per Web IDL [1], Dictionaries are not nullable when used as the type of an operation argument (or a dictionary member).
So null will never be passed to the implementation of find().
However, calling "navigator.contacts.find(null);" will not throw. Instead, null will be converted to a dictionary as defined by Web IDL [2] and that dictionary will be passed to the implementation of find().
[1] http://heycam.github.io/webidl/#idl-nullable-type
[2] http://heycam.github.io/webidl/#es-dictionary (See Step 5.2. if Type(V) is Null)
Kr,
On 12/18/2013 05:03 AM, Huang, Deqing wrote:
Hi,
In Contacts Manager API spec, parameter "option" of find() is optional but not nullable:
http://www.w3.org/2012/sysapps/contacts-manager-api/#widl-ContactsManager-find-Promise-ContactFindOptions-options
What does that mean? Is there any difference between optional and nullable?
Thanks in advance.
Regards,
Deqing
--
Christophe Dumez - Samsung Telecommunications America