"Exception: parameter(s) with default followed by parameter without default"

Oliver Hunt oliver at apple.com
Wed Oct 10 09:55:43 PDT 2012


On Oct 10, 2012, at 9:12 AM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:

> 
> On Oct 10, 2012, at 6:39 AM, David Bruant wrote:
> 
>> 2012/10/10 Keith Cirkel <es-discuss at keithcirkel.co.uk>
>> You /are/ actually passing in a second argument though, your second argument is `undefined`. Default arguments aren't meant to replace `undefined` values, they're meant to be permissible for omission.
> 
> 
> No, that isn't what the draft specification now says.  It was originally that way, but TC39 based upon discussions here, decided that an explicit undefined argument value triggers default value initialization.

I still disagree with this decision, but from an implementation standpoint the cost difference is fairly minimal (there is of course an additional runtime performance cost, but i suspect it would be negligible).

I guess it depends on whether the committee feels that we should be encouraging the use of null over undefined in new syntactic constructs.

--Oliver

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121010/a621a24a/attachment-0001.html>


More information about the es-discuss mailing list