Skip to content

Allow overload resolution to "round down"? #581

Open

Description

Image for: Description

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

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:

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

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

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

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

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

  6. 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.

Metadata

Image for: Metadata

Metadata

Image for: Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Image for: Issue actions