W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2012

Re: Unclear behavior of dictionary member default values

From: Cameron McCormack <cam@mcc.id.au>
Date: Mon, 25 Jun 2012 13:52:42 +1000
Message-ID: <4FE7E08A.9000800@mcc.id.au>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
CC: public-script-coord@w3.org
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

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:06 UTC