New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Given [Constructor, Constructor(DOMString x)], new C(undefined) picks the second #351
Comments
This behavior was deliberately used with Here Blink's IDL now matches the spec, but there are other cases of optional vs. override mismatches that might be observable. @mdittmer, would you be able to interrogate your dataset to find all such cases? I think that to just "trim trailing undefineds" wouldn't work, certainly if |
Yeah, this design is also deliberately used by XMLHttpRequest's open(). Avoid overloads if you don't want weird cases and use unions and optional instead. |
As previously mentioned, this is very much by design: overloads discriminate on argc first, and there are specs that depend on that. If DOMMatrix wants to treat undefined first arg as no args, it should be doing:
(or |
It seems they could just have |
Yes, that would be an option as well, with an extra case for "sequence has 0 elements" at https://drafts.fxtf.org/geometry/#dom-dommatrix-dommatrix-numbersequence |
That depends on whether you want to allow |
Fair, "" is better then as they already handle that. |
@zcorpan ^^ |
There was talk of not exposing the string signature in workers, but exposing the rest, so whether to use |
Mark helped me out with this offline, and among the candidates no other problematic cases were found. It didn't include constructors though, so there might be more like DOMMatrix waiting to be discovered. |
In particular by my reading the overload resolution algorithm, the step
immediately disqualifies the no-arg constructor from consideration.
This seems not so great. Can we "trim trailing undefineds" before invoking the overload resolution algorithm?
/cc @bzbarsky
This is concretely an issue for DOMMatrix.
The text was updated successfully, but these errors were encountered: