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

David Bruant bruant.d at gmail.com
Wed Oct 10 06:39:33 PDT 2012

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.

>From https://bugzilla.mozilla.org/show_bug.cgi?id=781422#c1
    function f(x=EXPR) { BODY }
will expand to:
    function f(x) {
        if (x === undefined)
            x = EXPR;

It seems that default arguments are meant to replace 'undefined' for last
arguments and that's my experience playing with the latest nightly where
the bug has been fixed.

What's the intention of the spec?
Is current Firefox Nightly compliant?
Can test262 tests be added to express what is expected from implementors?
Debating tests would enable keeping track of the discussions that occurred
and record the decision in an (arguably) more formal way than the spec.

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

More information about the es-discuss mailing list