- From: Cameron McCormack <cam@mcc.id.au>
- Date: Wed, 21 Dec 2011 09:26:19 +1100
- To: public-script-coord@w3.org, Simon Pieters <simonp@opera.com>
Cameron McCormack: >> Ignoring the issue of explicitly passing undefined meaning "consider >> this an un-passed optional argument" and whether we want to revisit >> that (http://www.w3.org/mid/4EEEA0F0.5010906@mcc.id.au), overload >> resolution in this proposal goes as follows: >> >> * Generate the "effective overload set" for the given identifier >> and argument list length. Union types do not get expanded out >> into multiple entries like optional arguments do. >> >> * For each argument position: >> >> * For each entry in the effective overload set: >> >> * If the type is one of the exactly matching types mentioned >> above, or is a union type consisting only of the exactly >> matching types, and the JS value passed in does not match >> it, then disqualify this entry. Simon Pieters: > For nullable types, null is considered to match? Yes. > What about > > void f(DOMString? x); > void f(Node? x); > > Both would qualify if null is passed in (actually even if the DOMString > type isn't nullable). That's not allowed, since "DOMString?" and "Node?" are not distinguishable. > Similarly, what about nullable unions? > > void f(DOMString? or Node? x); Again that would not be allowed, since the members of the union all have to be distinguishable (apart from primitives and DOMString). You could write "(DOMString or Node)?" or "DOMString or Node?". ... > Overall looks good to me! Great!
Received on Tuesday, 20 December 2011 22:27:00 UTC