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

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