On Oct 10, 2012, at 6:39 AM, David Bruant wrote: > 2012/10/10 Keith Cirkel <[email protected]> > 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. > > 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; > BODY > } > > 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? no > 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. Yes, if a contributor writes them. But the starting point for the tests need to be what the specification actually says. Allen
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

