Re: Unclear behavior of dictionary member default values

Boris Zbarsky:
> It's not quite clear to me what the right behavior of dictionary member
> default values is.  Specifically:
>
> 1)  For a dictionary argument, does the implementation actually need to
> keep track of whether a member with a default value was present or not?
>   Or can it simply set the member to that default value and treat it as
> present?

I think the spec implies that dictionary members that have default 
values can be "not present", since it says:

   Dictionary members can also optionally have a default value, which
   is the value the dictionary member is to be considered to have when
   not present.

But I don't think there's a good reason to, so I've changed that:

http://dev.w3.org/cvsweb/2006/webapi/WebIDL/Overview.xml.diff?r1=1.551;r2=1.552;f=h

> 2)  For dictionary return values, what, if anything, should happen with
> default values?  Should they end up on the JS object if the relevant
> member was not present in the dictionary?

Since they'll always be considered present now, they should always end 
up on the JS object.

Received on Monday, 25 June 2012 03:53:15 UTC