On Jan 17, 2012, at 10:14 AM, Grant Husbands wrote: > 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.
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. > > 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. Perhaps we can describe a general transformation that converts an IterationStatement to/from an equivalent call to an iteration function with block lambda arguments. Allen > > Or I might be misreading. > > Regards, > Grant Husbands. >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss