Re: [heycam/webidl] Dictionary types being nullable doesn't make sense (#967)

I may have hidden my point in some of the details.

`MyDict` and `MyDict?` are *identical* in terms of what values satisfy them, but both are allowed. `(DOMString or MyDict)`, `(DOMString or MyDict?)`, and `(DOMString or MyDict)?` are identical as well, but the last one is disallowed.

<https://github.com/heycam/webidl/commit/6ac261bd550ce99d62c54ccf831b4e0ab7dee5df> was the commit that happened to make the change that allowed `MyDict?`, but (I assume by accident?) left the prohibition against `(DOMString or MyDict?)` alone, resulting in today's confusing world where dictionaries are explicitly nullable *only sometimes* (but implicitly nullable *all the time*).

My suggestion is that we return to the prohibition against explicitly nullable dictionaries everywhere, so `MyDict?` and `(DOMString or MyDict?)` both go back to being invalid syntax. This won't result in any observable API change, since a JS `null` always satisfies a dict type anyway.

-- 
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/967#issuecomment-799530311

Received on Monday, 15 March 2021 15:53:08 UTC