RE: Interactions between optional and nullable

Hi Robin,

>From this text:
" An argument is considered to be an optional argument  if it is declared with the "optional" keyword. The final argument of a variadic operation  is also considered to be an optional argument. Declaring an argument to be optional indicates that an the argument value can be omitted when the operation is invoked. An argument MUST NOT  be declared to be optional unless any subsequent arguments to the operation are also optional."

and example at [1] I derive that

      void foo (optional Foo foo, optional Bar bar);
Bar is already made optional by Foo being optional.

I think this would be the same:
      void foo (optional Foo foo, Bar bar);
and would result in the following effective overload set:

{
 < foo, ()>,
 < foo, (Foo, Bar)>
}

I think you cannot skip the first parameter and supply the following ones.

I assume that this one would result in the following "nullable effective overload set" (term just for this email):
      void foo (optional Foo? foo, Bar bar);

{
 < foo1, ()>,
 < foo1, (Foo, Bar)>,
 < foo1, (null, Bar)>
}

>>Assuming I want to call myDahut.foo() but skip the first parameter,
>>the idiomatic ES would typically be:
I think that with the existing WebIDL spec you could use the declaration with variadic operation like:
      void foo (any... foo);
and leave it all to the underlying JS engine,
or overload as:
  interface Dahut {
      void foo (optional Foo? foo, Bar bar);
      void foo (Bar bar);
  };

Anyway, let's see what the others say.

Thanks,
Marcin


[1] http://dev.w3.org/2006/webapi/WebIDL/#idl-overloading


Marcin Hanclik
ACCESS Systems Germany GmbH
Tel: +49-208-8290-6452  |  Fax: +49-208-8290-6465
Mobile: +49-163-8290-646
E-Mail: marcin.hanclik@access-company.com

-----Original Message-----
From: public-script-coord-request@w3.org [mailto:public-script-coord-request@w3.org] On Behalf Of Robin Berjon
Sent: Tuesday, December 08, 2009 4:39 PM
To: public-script-coord@w3.org
Subject: Interactions between optional and nullable

Hi,

I've been trying to figure out what the expected approach should be for the following case:

  interface Dahut {
      void foo (optional Foo foo, optional Bar bar);
  };

Assuming I want to call myDahut.foo() but skip the first parameter, the idiomatic ES would typically be:

  myDahut.foo(null, myBar);

But it turns out that the first parameter isn't defined as nullable. What happens here?

 1) Is the implementation supposed to figure out that I didn't want to provide the first parameter? Maybe convert it to undefined?
 2) Are people expected to call myDahut.foo(undefined, myBar) instead?
 3) Should the operation be better defined with Foo being nullable?

Thanks!

--
Robin Berjon
  robineko - hired gun, higher standards
  http://robineko.com/



________________________________________

Access Systems Germany GmbH
Essener Strasse 5  |  D-46047 Oberhausen
HRB 13548 Amtsgericht Duisburg
Geschaeftsfuehrer: Michel Piquemal, Tomonori Watanabe, Yusuke Kanda

www.access-company.com

CONFIDENTIALITY NOTICE
This e-mail and any attachments hereto may contain information that is privileged or confidential, and is intended for use only by the
individual or entity to which it is addressed. Any disclosure, copying or distribution of the information by anyone else is strictly prohibited.
If you have received this document in error, please notify us promptly by responding to this e-mail. Thank you.

Received on Tuesday, 8 December 2009 16:35:46 UTC