Generator issue: exceptions while initializing arguments
Brendan Eich
brendan at mozilla.com
Mon Sep 10 10:08:04 PDT 2012
Jason Orendorff wrote:
> On Sun, Sep 9, 2012 at 8:50 PM, Jason Orendorff
> <jason.orendorff at gmail.com> wrote:
>> 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
>> }
>
> In case it isn't clear what I'm saying here, I think the same
> desugaring should hold for generators. Exceptions would then be
> deferred to "loc 2" in Allen's example.
Agreed. My loc 1 initial reaction was based on the shallow preference
for early vs. late errors in the contrived "thrower" case.
/be
More information about the es-discuss
mailing list