- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Tue, 11 Jun 2013 23:42:28 -0400
- To: Rik Cabanier <cabanier@gmail.com>
- CC: "public-script-coord@w3.org" <public-script-coord@w3.org>
On 6/11/13 11:28 PM, Rik Cabanier wrote: > You've told me that dictionary members are optional by default [1]. Why > does their IDL have '?' for most entries? Isn't that implied since every > entry is optional anyway? Consider these two dictionaries: dictionary Foo1 { DOMString member; }; dictionary Foo2 { DOMString? member; }; and this object being converted to those dictionary types: { member: undefined }. Foo1 will produce { member: "undefined" } while Foo2 will produce { member: null }. Similarly, for { member: null }, Foo1 will produce { member: "null" } while Foo2 will produce { member: null }. This has nothing to do with the fact that having "member" is optional; that just affects what happens when an object that does not have a "member" property is involved. -Boris
Received on Wednesday, 12 June 2013 03:42:58 UTC