Re: Ugly inconsistence betw. for and for/in
Jochen Theodorou <[email protected]>
| Newsgroups | gmane.comp.lang.groovy.devel |
|---|---|
| Message-ID | <[email protected]> |
On 05.09.25 17:17, Milles, Eric (TR Technology) via dev wrote: > NOTE: Groovy 5 removes the expression *list* support from the first part > of a classic form — variable declaration is the only option. > > So, "for (foo = 1, bar = 2;' ...; ...)" is no longer possible. You must > write "for (def foo = 1, bar = 2; ...; ...)" or "for (def (foo,bar) = > [1,2]; ...; ...)". aren't we breaking Java-compatibility here? Just look at ForControl https://docs.oracle.com/javase/specs/jls/se7/html/jls-18.html oh, maybe a newer version of Java: https://docs.oracle.com/javase/specs/jls/se24/html/jls-14.html#jls-14.14.1 ForInit :StatementExpressionList |LocalVariableDeclaration ; was there a specific reason to remove StatementExpressionList, or was it never in there and nobody noticed so far? bye Jochen