Define a way to specify a default value for dictionaries (the literal "{}") and require it to be specified for the dictionary arguments that are required to be optional.#750
Conversation
|
Note that this will require a ton of spec updates, by the way, to add all the now-required |
Ms2ger
left a comment
There was a problem hiding this comment.
This seems fine. (My first thought was to use = null, but maybe this is clearer.)
|
Created PRs for whatwg/dom#771 and whatwg/html#4745. This will require Bikeshed changes too, tracked at speced/bikeshed#1491 and plinss/widlparser#39 for the IDL parser backend. |
Mine was too, and is in fact what Gecko has long implemented, but @annevk convinced me that this is more what people are likely to expect. |
"{}") and require it to be specified for the dictionary arguments that
are required to be optional.
Fixes whatwg#585
Fixes whatwg#602
a740e17 to
5d249a7
Compare
|
@annevk thank you for filing all those! |
|
https://bugzilla.mozilla.org/show_bug.cgi?id=1562680 tracks Gecko implementing this. |
|
We probably need to get a bunch of other spec issues filed... Can we hope the bikeshed changes will drive that, or should we go through the list of changes I needed to make to IDLs in Gecko and try to file issues based on that? |
|
If you can dump a file list in a new issue for triage that'd be good I think. The other problem with updating IDL in the specifications is that we also need testharness support as it automatically gets the IDL from the specifications. |
|
webidl2.js is fixed in w3c/webidl2.js#338, but the copy in wpt isn't updated yet. |
|
Just recording that the relevant bug on the Blink side is: https://bugs.chromium.org/p/chromium/issues/detail?id=948139 Do we know if the WebKit folks are aware of this change? |
Required after whatwg/webidl#750. (Found from web-platform-tests/wpt#18382)
|
In both webidl2.js and bikeshed right now, this code is accepted: dictionary A {
required long x;
};
dictionary B {
A a = {};
};but it seems like this ought to be invalid since Semi-related, I'm not sure I know what |
That would be an option, yes.
Per spec that does not work, right.
It allows Chrome's bindings generator has all sorts of bugs around dictionaries, so I wouldn't base too much on what it does, but the desire for the |
|
That's really helpful, thanks for the info!
(fwiw, webidl2.js and bikeshed do allow this, too.) |
I neither wouldn't base too much on what they allow, because both have been just parsers without semantics checks, while only recently webidl2.js started providing some. |
Right, it arguably used to be OK (and was supported in Gecko) until the changes in this PR. At this point it's clearly not OK, though. IDL |
Fixes #585
Fixes #602
@tabatkins @annevk @domenic @Ms2ger thoughts?
Preview | Diff