Control invocation syntax

Neal Gafter neal at gafter.com
Mon Dec 14 10:48:00 PST 2009


On Mon, Dec 14, 2009 at 10:33 AM, Paul Benedict <pbenedict at apache.org>wrote:

> The syntax reads:
>
> ControlInvocationStatement:
>  foropt Primary ( FormalParameters : ExpressionListopt ) Statement
>  foropt Primary ( ExpressionListopt ) Statement
>
> But the "with" method declaration does not use the "for" keyword. Am I
> misunderstanding? It is used in Loop Abstractions, which I expect.
>

The "for" keyword is optional when defining a method that is intended to be
used with the contol invocation syntax.  It is used when the method is
intended to be used like a loop.  The "with" method is not intended to be
used as a loop, so it is not defined with the "for" keyword.  That means
that "break" and "continue" ignore a control invocation of the "with"
method.

Cheers,
Neal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/closures-dev/attachments/20091214/833c76b1/attachment.html 


More information about the closures-dev mailing list