Re: [heycam/webidl] 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)

> but it seems like this ought to be invalid since {} is not a valid A

That would be an option, yes.

> = null seems like it should equally not work.

Per spec that does not work, right.

> Does this allow a to be "A or undefined"?

It allows `a` to be not present (that is the `Get()` on the JS object returns `undefined`), but if it's present (any other value is returned) then it only allows values that can be converted to `A` without failing.

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 `dictionary C { A a; }` case where `A` has required members and allowing `{}` to be passed for a `C` instance was present in a number of specs, so the IDL spec explicitly allows that.

-- 
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/pull/750#issuecomment-536244035

Received on Sunday, 29 September 2019 03:10:36 UTC