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

[Bug 16725] Treat omitted dictionary the same as empty dictionary

From: <bugzilla@jessica.w3.org>
Date: Sat, 14 Apr 2012 03:34:14 +0000
To: public-script-coord@w3.org
Message-Id: <E1SItkc-0006jj-Fg@jessica.w3.org>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=16725

--- Comment #1 from Cameron McCormack <cam@mcc.id.au> 2012-04-14 03:34:12 UTC ---
I agree it would be good not to have to write things like

  1. Let dict be b if it were specified, or an empty dictionary of type B
     otherwise.
  2. Do something with the "foo" member of dict.

but I'm not sure what to use instead.  I think it might be a bit confusing to
allow

  1. Do something with the "foo" member of b.

if b weren't specified at all.  I guess you're suggesting that it's like
there's a default { } value for the optional argument, but have dictionary
types get a default value automatically seems inconsistent with other types. 
What about an explicit

  [Constructor(optional B b = { })]
  interface A { };

?  Might be too much visual noise for what's probably going to be a very common
case.  Let me know if you have any more concrete suggestions.

> Also "the value the dictionary member is to be considered to have when not
> present" is pretty vague language and should be tightened up with something
> clear and containing some normative keyword...

I guess it's vague, but it's just stating the meaning of "default value". 
Later on there is wording that says the bit after the "=" gives the default
value and how the actual tokens are considered as IDL values.  What more do you
think needs saying?

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
Received on Saturday, 14 April 2012 03:34:16 UTC

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