Hi Allen, On 2015-04-06 02:08, Allen Wirfs-Brock <[email protected]> writes:
> Alan,
>
> I freed up a couple minutes for a quick look at this. I want to spend some
> more time look at it deeper as this is an area where I made some fixes just
> a couple weeks ago and I want to review them again to make sure everything is
> as intended.
>
> But, for now a quick answer to your question is: yes there is an intentional
> difference.
>
> For blocks that are not part of loops (and top level StatementLists) we wanted
> to preserve the legacy completion values described in the NOTE at the end of
> 13.1.13. this requires preserving empty completion values originating from
> stand-alone blocks. However, we also wanted all control flow statements to
> always produce a non-emptry completion value.
I understand. In fact, it seems that this particular behavior did not
change between ES 5 and ES 6: block evaluation guarantees the last value
computed is returned, whereas loops don't. According to my tests,
neither V8 nor SpiderMonkey have this behavior:
var c; a: { c = 1; while(true) { if (c) { c=0; } else { break a; } } }
returns 0 in both, whereas the spec says it should be 1 (caveat:
I tested in a current Chrome and Firefox browsers, I don't know if it's
the correct environment to do such tests).
Does this inconsistency matter?
Thanks,
Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
signature.asc
Description: PGP signature
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

