> My question was whether the semantics of break and continue would > support the following:
Yes, this is another good case to consider. Thanks for pointing it out; I'll add this to the strawman:lambdas proposal. Essentially this is another aspect of the semantics of 'function' that is implicit -- that it cancels out the scope of break/continue labels -- and it's precisely these implicit elements of a language feature that break expected equivalences. (They are essentially "unhygienic" -- if you push me, I can explain the connection to macros.) > while(true) { > (function() { > if (--x == 0) break; > })(); > } Note that the 'lambda' proposal is intended to be separate from 'function', whose semantics would be left unchanged. So your example would still be disallowed, but this: while(true) { (lambda() { if (--x == 0) break; })(); } would be allowed. > I honestly don't know, but it shouldn't cause any real trouble to > allow it. The implementation would be analogous to that for labeled > return. For example, if the appropriate while loop is no longer on the > stack, the "break" would turn into an exception. That's correct. Dave _______________________________________________ Es-discuss mailing list Es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss