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

Re: Unclear behavior of dictionary member default values

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 08 Jun 2012 10:05:15 -0400
Message-ID: <4FD2069B.6010004@mit.edu>
To: Anne van Kesteren <annevk@annevk.nl>
CC: public-script-coord@w3.org
On 6/8/12 3:37 AM, Anne van Kesteren wrote:
> On Fri, Jun 8, 2012 at 9:25 AM, Boris Zbarsky<bzbarsky@mit.edu>  wrote:
>> If the question was what specs use default values on dictionaries... WebGL
>> does for the WebGLContextAttributes dictionary.
> The problem I was pointing out is prevalent there. It appears the
> WebGLContextAttributes dictionary is passed as second argument to the
> getContext() method. That argument is optional.

Ah, you were talking about the whole dictionary being optional!  OK.

Are there use cases for having an API where passing an empty dictionary 
and not passing a dictionary at all have different behavior?  If not, it 
might be nice if WebIDL just handled this so you could actually usefully 
declare the whole thing in IDL instead of having to do it in prose...

> They solve this using some prose "The default value is used either if
> no second parameter is passed to getContext, or if a user object is
> passed which has no attribute of the given name." but that seems
> hacky.

Could we move that sort of language into WebIDL?  ;)

Received on Friday, 8 June 2012 14:05:47 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:06 UTC