[heycam/webidl] Allow overload resolution to "round down"? (#581)

In simplifying document.open() (see https://github.com/whatwg/html/pull/3946) we would ideally like to have two overloads:

```webidl
partial interface Document {
  [CEReactions] Document open();
  WindowProxy open(USVString url, DOMString name, DOMString features);
}
```

However, according to the overload resolution algorithm, if we did this, calls to `document.open("historical", "historical")` would throw pretty quickly:

0. Effective overload set = { open(), open(url, name, features) }

1. Let maxarg be the length of the longest type list of the entries in S = 3.

2. Let n be the size of args = 2.

3. Initialize argcount to be min(maxarg, n) = 2.

4. Remove from S all entries whose type list is not of length argcount. S = empty set

5. If S is empty, then throw a TypeError.

Would it be possible to tweak this to allow ignoring extra arguments? That seems more JavaScriptey to me...

Pointers to previous discussions appreciated.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/581

Received on Tuesday, 21 August 2018 18:07:50 UTC