[
https://issues.apache.org/jira/browse/GROOVY-11601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17941910#comment-17941910
]
Eric Milles edited comment on GROOVY-11601 at 4/8/25 3:04 PM:
--------------------------------------------------------------
Support for expression list in the 2nd and 3rd clauses is unchanged. I think
examples A and C are still supported but not tested.
Example B would be supported this way now:
{code:groovy}
for (def (List items2, int i, long j) = [[], 3, 70]; i < 8; i++, j -= 10) {
}
{code}
re: Example D, where do "i" and "j" come from?
{code:groovy}
for ((i, j)=[3, 70]; i < 8; { i++; j -= 10; println '*' }()) {
}
{code}
It could be re-written as:
{code:groovy}
(i, j)=[3, 70]
for (; i < 8; { i++; j -= 10; println '*' }()) {
}
{code}
was (Author: emilles):
Support for expression list in the 2nd and 3rd clauses is unchanged. I think
example A and C are still supported but not tested.
Example B would be supported this way now:
{code:groovy}
for (def (List items2, int i, long j) = [[], 3, 70]; i < 8; i++, j -= 10) {
}
{code}
re: Example D, where do "i" and "j" come from?
{code:groovy}
for ((i, j)=[3, 70]; i < 8; { i++; j -= 10; println '*' }()) {
}
{code}
It could be re-written as:
{code:groovy}
(i, j)=[3, 70]
for (; i < 8; { i++; j -= 10; println '*' }()) {
}
{code}
> remove support for expression list in for-each statement
> --------------------------------------------------------
>
> Key: GROOVY-11601
> URL: https://issues.apache.org/jira/browse/GROOVY-11601
> Project: Groovy
> Issue Type: Improvement
> Components: parser-antlr4
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Minor
>
> The for-each loop supports an arbitrary expression list. Presumably this is
> for legacy reasons. Now that multi-variable declaration is supported by
> for-each and classic for, it does not seem necessary to support expression
> list. I propose to remove it from the parser grammar.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)