W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2011

Re: [WebIDL] Handling undefined in Overload Resolution Algorithm

From: Jonas Sicking <jonas@sicking.cc>
Date: Tue, 19 Jul 2011 11:30:45 -0700
Message-ID: <CA+c2ei_a=D-KhVMqD3zigOgcev9uW0wLqLGHTU=1xnL30VO==A@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: public-script-coord@w3.org
On Tue, Jul 19, 2011 at 10:32 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 7/19/11 1:06 PM, Jonas Sicking wrote:
>>
>> On Tue, Jul 19, 2011 at 6:04 AM, Lachlan Hunt<lachlan.hunt@lachy.id.au>
>>  wrote:
>>>
>>> Hi,
>>>  Refer to discussion in a Mozilla bug 648722 [1].
>>>
>>> When undefined in passed to an overloaded function, the overload
>>> resolution
>>> algorithm should not exclude nullable non-primitive types.
>>
>> I'm not quite sure I understand what you are suggestion. Are you
>> saying that we should treat undefined as null when calling a function
>> that takes a nullable type?
>
> That's the proposal, yes.  This is already true if the nullable type is
> something like |String?|, but not if the nullable type is |Node|.  The
> proposal is to make is to passing |undefined| where an interface type is
> expected behaves the same as passing null (as opposed to throwing
> immediately because no overload is found).

That would work for me. So with the interface

interface Foo {
  void func(in DOMString a, in Node? b);
  void func(in DOMString a);
};

the following code:

myfoo.func("hello", undefined);

will call the first func-function. Right?

/ Jonas
Received on Tuesday, 19 July 2011 19:03:18 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:04 UTC