Block Lambdas: break and continue

Herby Vojčík herby at mailbox.sk
Wed Jan 18 02:34:42 PST 2012


Brendan Eich wrote:
>>
>> Allen Wirfs-Brock <mailto:allen at wirfs-brock.com>
>> January 17, 2012 7:56 PM
>>
>> On Jan 17, 2012, at 10:14 AM, Grant Husbands wrote:
>>
>>> I think others might have better answers, but it seems that the
>>> meaning of 'break' is to stop the whole statement, and the meaning of
>>> 'continue' is to skip the inner block and hence return to
>>> arr.alternate. I'm sorry for my woolly language, but it seems
>>> relatively equivalent to a for loop, in which 'break' stops the whole
>>> statement and 'continue' skips the inner block and hence returns to
>>> the looping code.
>>
>> Yes, that was the intended meaning I was trying to express. But what I
>> was illustrating was that for this to work a continue wihout a target
>> label and an equivalently located break without a target label need to
>> unwind to different points in the enclosing nesting structure. This
>> seems different (perhaps surprisingly so) from equivalent
>> continue/breaks nested only within blocks and an /IterationStatement/.
>> But that is the semantics that are need to fulfill my intent is this
>> particular case. Maybe this generalizes to all use reasonable cases,
>> but it something about it makes me feel a bit uncomfortable.
>
> Agreed, so I'm checking my impulse to extend
> http://wiki.ecmascript.org/doku.php?id=strawman:block_lambda_revival and
> aiming at separated strawmen for do: and break/continue-with. Not sure
> at this point when I'll get to them, more discussion welcome.

See below.

>>> Perhaps what I'm saying is that I think "do:" is a label for the whole
>>> callexpression, covering all lambda-block parameters. As far as the
>>> specification goes, a continue that 'hits' the block lambda may well
>>> be best described as a local return.
>>
>> Yes, this seems about right. But can this behavior for break/continue
>> be explained in a way that doesn't seems arbitrarily different from
>> break/continue in the context of /IterationStatements/ and regular
>> blocks.

Maybe you can, after all, read my post on the topic from few days ago. 
It is not _that_ long, it does break/continue with specifying value, and 
it gives them concise meaning (which is easily updateable for case of 
"label: { ....; break label; ... }" as well as "for call() {|| ...})".

> /be

Herby


More information about the es-discuss mailing list