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: Cameron McCormack <cam@mcc.id.au>
Date: Mon, 24 Jun 2013 17:50:48 +1000
Message-ID: <51C7FA58.2050206@mcc.id.au>
To: Allen Wirfs-Brock <allen@wirfs-brock.com>
CC: Brendan Eich <brendan@mozilla.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>, Boris Zbarsky <bzbarsky@MIT.EDU>
Allen Wirfs-Brock wrote:
> Cameron, Either I'm misinterpreting what you are trying to say or you
> misunderstand what Boris said.  ES6 does allow a parameter with an
> explicit default value to be followed by one without an explicit
> default value.  The NOTE in 13.1 for ExpectedArgumentCount says:
> "...A FormalParameter without an initialiser is allowed after the
> first parameter with an initialiser but such parameters are
> considered to be optional with undefined as their default value."
> That semantics is normatively specified in the algorithms that
> validate a formal parameter list.
>
> This is all about determining the "length" value of a function.
> Length is the number of required arguments which is defined to be the
> number of formal parameters to the left of  the first parameter with
> a default value initializer (or the rest parameter).

Thanks Allen, I also hadn't realised that the ES6 spec had allowed 
argument initialisers everywhere.


I've made the corresponding Web IDL changes now to allow optional 
arguments and default values everywhere, too.

Boris, when you're able to, review of these changes would be appreciated.

http://dev.w3.org/cvsweb/2006/webapi/WebIDL/Overview.xml.diff?r1=1.628;r2=1.629;f=h
http://dev.w3.org/cvsweb/2006/webapi/WebIDL/v1.xml.diff?r1=1.78;r2=1.79;f=h
Received on Monday, 24 June 2013 07:54:44 UTC

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