[webidl] Non-optional final dictionary arguments with required fields? (#46)

http://heycam.github.io/webidl/#dfn-optional-argument currently says:

> If the type of an argument is a dictionary type or a union type that has a dictionary type as one of its flattened member types, and this argument is either the final argument or is followed only by optional arguments, then the argument must be specified as optional. Such arguments are always considered to have a default value of an empty dictionary, unless otherwise specified.
>
> Note: This is to encourage API designs that do not require authors to pass an empty dictionary value when they wish only to use the dictionary’s default values.

If the dictionary has a [`required`](http://heycam.github.io/webidl/#required-dictionary-member) field, then the empty-dictionary default wouldn't work, so it seems odd to have to mark the dictionary as `optional`.

I'm thinking of operations where `theOperation(reqVal, {opt1: val1, opt2: val2})` is less clear than `theOperation({reqVal: val0, opt1: val1, opt2: val2})`, like [`requestDevice()`](https://webbluetoothcg.github.io/web-bluetooth/#device-discovery) in the Web Bluetooth spec.

---
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/46

Received on Tuesday, 7 April 2015 20:05:55 UTC