Block Lambdas: break and continue

Grant Husbands esdiscuss at
Tue Jan 17 10:14:25 PST 2012

Allen Wirfs-Brock wrote:
> do: arr.alternate ({|o| if (...) continue; if (...) break; ...}, {|o| if
> (...) continue; ...});
> I don't see how this can support the most likely intended semantics

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.

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.

Or I might be misreading.

Grant Husbands.

More information about the es-discuss mailing list