On Sat, Sep 8, 2012 at 3:01 PM, Allen Wirfs-Brock <[email protected]> wrote:
> This is the first of probably several semantic issues WRT generator that
> will need to be resolved in the spec.
I mentioned this to David Herman when we started implementing default
parameters.
What I think is that default parameters should be specified to be as
much like the following desugaring as possible:
function f(x=EXPR1, y=EXPR2) { BODY }
===>
function f(x, y) {
if (x === void 0) x = EXPR1;
if (y === void 0) y = EXPR2;
BODY
}
Here is my rationale:
* The question is really about the semantics of default params,
not generators.
* Default parameters are a convenience feature:
certainly welcome and useful, but not powerful,
and thus by the principle of least astonishment
they should in fact be skin-deep.
I think this is what Brendan's saying as well.
SpiderMonkey's current implementation of default params isn't quite
right in a few ways. I'll file some bugs and we'll get after it.
-j
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss