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

Re: new overloading model

From: Cameron McCormack <cam@mcc.id.au>
Date: Wed, 21 Dec 2011 19:17:10 +1100
Message-ID: <4EF19606.4080609@mcc.id.au>
To: Simon Pieters <simonp@opera.com>
CC: public-script-coord@w3.org
Simon Pieters:
> OK, but doesn't this give two candidates?
>
> void add(HTMLOptionElement element, optional HTMLElement? before);
> void add(HTMLOptGroupElement element, optional HTMLElement? before);
> void add(HTMLOptionElement element, long before);
> void add(HTMLOptGroupElement element, long before);
>
> options.add(document.createElement('option'), null);

No, since you would consider nullable interface types to also be exactly 
matchable.  You'd start off with this set:

   { <add, (HTMLOptionElement)>,
     <add, (HTMLOptionElement, HTMLElement?)>,
     <add, (HTMLOptGroupElement)>,
     <add, (HTMLOptGroupElement, HTMLElement?)>,
     <add, (HTMLOptionElement, long)>,
     <add, (HTMLOptGroupElement, long)> }

then you'd remove the length-1 entries:

   { <add, (HTMLOptionElement, HTMLElement?)>,
     <add, (HTMLOptGroupElement, HTMLElement?)>,
     <add, (HTMLOptionElement, long)>,
     <add, (HTMLOptGroupElement, long)> }

then you would start on the loop per argument position and entry.  The 
two HTMLOptGroupElement entries would be disqualified because interface 
types are an exact match, and the value passed in is an 
HTMLOptionElement instead.  For the second argument, the JS null value 
does not exactly match the long types, so those would be disqualified 
too.  You should be left just with the (HTMLOptionElement, HTMLElement?) 
entry.
Received on Wednesday, 21 December 2011 08:17:50 UTC

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