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: Tue, 18 Jun 2013 08:24:04 -0400
Message-ID: <51C05164.8010009@mit.edu>
To: Cameron McCormack <cam@mcc.id.au>
CC: Allen Wirfs-Brock <allen@wirfs-brock.com>, Brendan Eich <brendan@mozilla.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>
On 6/18/13 2:15 AM, Cameron McCormack wrote:
> So what about this part of the proposal?  Presumably there are reasons
> that ES6 currently forbids an argument with a default value that is
> followed by one without a default value.

The reason I was given is that given

   function f(a = 5, b) {
   }
   f(6);

it's not clear whether that maps to (a=6,b=undefined) or to (a=5,b=6).

That said it's pretty clear to me that it maps to the former.  On the 
other hand, it sure would be handy to be able to do f(undefined, 6) and 
have it come out with (a=5,b=6).

-Boris
Received on Tuesday, 18 June 2013 12:24:35 UTC

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