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

Re: Reconciling handling of optional arguments and handling of default values across ES and webidl

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 08 May 2013 21:18:24 -0400
Message-ID: <518AF960.5090605@mit.edu>
To: Allen Wirfs-Brock <allen@wirfs-brock.com>
CC: "public-script-coord@w3.org" <public-script-coord@w3.org>
On 5/8/13 9:14 PM, Allen Wirfs-Brock wrote:
> There are several built-in library functions in ES that make this distinction.  For example:
>     Array(500)   //create an array whose length is 500 with no  own elements.
> and
>     Array(500, undefined)  //create an array whose length is 2 with own properties 0: 500, 1: undefined

Ah, thank you

> They typically use words such as "if the foo argument was passed" or "if the foo argument is present".

Ok, so...

That's the sort of wording WebIDL uses right not for optional arguments. 
  People have been really vocal that passing undefined should be treated 
as "the argument was not passed"...

Do we consider APIs like the above good practice that WebIDL should make 
easy, bad practice that it should somehow enable for compat reasons, or 
bad practice that it should just disallow altogether?

> Probably even more significantly, any one who writes a function can make this distinction using the arguments object

Well, yes, today.

I guess let's take this requirement for ES as a sunk compatibility cost. 
  Where do we go with WebIDL?

-Boris
Received on Thursday, 9 May 2013 01:18:54 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:49 UTC