Brendan Eich wrote:
> I don't see how your proposal can work without exceptions. You write that
> it is syntactic sugar. Ok, what is the desugaring? How does
>
> for arr.ForEach { |o|
> if (...) break;
> }
>
> translate into JS without a throw that the implementation of arr.forEach,
> which is not modfiied by this for-prefixed invocation, can catch?
The above would desugar to:
label1: arr.ForEach { |o|
if (...) break label1;
}
If it had continue instead of break, it would desugar to:
arr.ForEach { |o|
label2: {
if (...) break label2;
}
}
It wouldn't need to be described as a desugaring in a strawman, given
the similarity to typical break/continue handling, but I think that
makes the meaning clear.
Regards,
Grant Husbands.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss