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

As far as I can tell, while `MyDict? foo()` is disallowed by that text, `(DOMString or MyDict?) foo()` is not.  There's some strange mixing of abstraction levels here, where it's explicitly talking about syntax ("identifier followed by ?") while also talking about types ("nullable type", slightly later). Due to this, I think it ends up missing the "nullable dict in a union" case.

Looking over the rest of the sections...

* consts are moot, as they're restricted to a small set of types
* attributes explicitly prevent dicts from appearing at all
* operations (including the special operations) have the weird restrictions that I think don't quite work, but clearly *want* to disallow nullable dicts as their return type
* value iterators are implicitly bound by the same restrictions as the indexed property getter, but pair iterators aren't, and can include nullable dicts
* maplikes and setlikes can include nullable dicts in their types
* callback functions can return nullable dicts

So aside from callback functions (which are fairly rare and I doubt use nullable dicts anywhere), only the newest sorts of constructs can return a nullable dict, and it should be safe (not to mention consistent) to ban them there as well.

That leaves us with just arguments that can still potentially take nullable dicts. @saschanaz any reasonable way to search for instances of this?

-- 
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-799693908

Received on Monday, 15 March 2021 19:30:50 UTC