On 6/29/12 12:25 PM, Joshua Bell wrote:
void f(float[] x); // overload A
void f(DOMString x); // overload B

WebIDL itself, of course, doesn't dictate how matching and dispatching
should be implemented

Actually, it does. http://dev.w3.org/2006/webapi/WebIDL/#dfn-overload-resolution-algorithm

The implication is that an IDL that defines methods
with signatures that are not distinguishable is invalid

Correct.

So rephrasing the question: are the above types distinguishable?

http://dev.w3.org/2006/webapi/WebIDL/#dfn-distinguishable seems pretty clear: yes.

And if so, which would be expected to handle the call:

f(null);

Several interpretations and hence outcomes occur to us

Per current spec, at http://dev.w3.org/2006/webapi/WebIDL/#dfn-overload-resolution-algorithm step 13 we have:

* Substep 2 is skipped because there are no nullable types or
  dictionaries here.
* Substeps 3-6 are skipped because null is not an object.
* In step 7 the overload with DOMString is selected

(3) T[] does not match null, but as null is an ECMAScript primitive
value it is run through ToString() and hence overload B is invoked with
DOMString "null"

This is what happens per spec at the moment, but the fact that null is a primitive value is somewhat irrelevant except insofar as it makes it not match the preconditions in substep 4.

-Boris

Reply via email to