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

Re: [WebIDL] Handling undefined in Overload Resolution Algorithm

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Tue, 19 Jul 2011 21:43:51 -0400
Message-ID: <4E2632D7.4070905@mit.edu>
To: public-script-coord@w3.org, Lachlan Hunt <lachlan.hunt@lachy.id.au>
On 7/19/11 7:24 PM, Lachlan Hunt wrote:
> Pretending for a moment that querySelector isn't an overloaded function,
> and say it only included the definition with the sequence<Null>? parameter:
> Element querySelector(in DOMString selectors, in sequence<Node>? refNodes);

More precisely:

Element querySelector(in DOMString selectors,
                       in optional sequence<Node>? refNodes);

> Passing undefined to that function, according to the current
> requirements in the WebIDL draft, the JS values of undefined and null
> are both converted to IDL null values in the ECMAScript to IDL
> conversion algorithm for nullable types.

One question is whether this is a conversion that makes sense for 
optional arguments...

Another question is what the behavior of the method should then be if 
the IDL null value is passed for the second argument.

> Regardless of whether that's the best handling of undefined for nullable
> types, the issue that needs to be resolved, however, is that because the
> method is actually overloaded (the other alternative accepting an
> optional Element node), the overload resolution algorithm in WebIDL
> picks neither and, I believe, throws an exception, which is very
> undesirable.

This is a third question, yes, unrelated to the above two.  I think we 
all agree that it needs to be resolved.

Received on Wednesday, 20 July 2011 01:44:20 UTC

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