Re: [whatwg/webidl] Require a default value for optional dictionary member of another dictionary? (Issue #1511)

kainino0x left a comment (whatwg/webidl#1511)

There are probably details in WebIDL that I don't understand, but this seems consistent with #602 already. My understanding - please check if this is correct - is:

- In a dictionary:
  - `dictionary Foo { Bar bar = {}; };` means that Foo `{}` == `{ bar: undefined }` == `{ bar: {} }`
  - `dictionary Foo { Bar bar; }; ` means that Foo `{}` == `{ bar: undefined }`, distinct from `{ bar: {} }`
- In a function:
  - `foo(optional Bar bar = {});` means that `foo()` == `foo(undefined)` == `foo({})`
  - `foo(optional Bar bar);` is not valid syntax

I'm also not entirely sure how this connects with needing to allow Foo `{ bar: false }` or `{ bar: true }` which we were discussing for `GPUBindGroupLayoutEntry`.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/issues/1511#issuecomment-3137929023
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/issues/1511/3137929023@github.com>

Received on Wednesday, 30 July 2025 21:55:24 UTC