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.

Received on Monday, 24 June 2013 07:54:44 UTC

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