Couple of alternative-syntax thoughts: 1. Empty label as optional prefix to CallWithBlockArguments, to make the block-lambda argument(s) breakable or continuable: : arr.forEach {|o| if (...) break; ... } The idea is that break or continue without label targets the nearest empty label or predefined target statement, whichever is closer. But I propose to narrow this to be a special prefix form only for CallWithBlockArguments. In an _expression_ context the leading colon requires parenthesization if used in the consequent of a ternary (?:) _expression_. In an object literal's PropertyAssignment you'd get a confusing ": :" juxtaposition. So it probably is better to require parentheses around empty-label-prefixed calls in all expressions. The continue case would exit the containing block-lambda argument to the :-labeled CallWithBlockArguments instead of exiting the whole CallWithBlockArguments _expression_. 2. Variation on empty label: support "do" as a reserved-identifier label that is implicitly addressed by break; and continue; (no labels on the break and continue). A little Smalltalk homage and not so visually nasty and potentiailly confusing as empty label. do: arr.forEach {|o| if (...) break; ... } To complete the Smalltalk homage we would want this in expressions, and we'd also want do: to take a block-lambda directly, in addition to a CallWithBlockArguments. This variation is future-hostile to leading-colon as statement- or _expression_-starting special forms (see http://wiki.ecmascript.org/doku.php?id=strawman:return_to_label). I think that this is acceptable but I could be missing something. Comments welcome. /be |
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss


