groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ocs@ocs" <...@ocs.cz>
Subject Re: multi-declaration does not work in the for loop, groovy 2.4
Date Mon, 06 Aug 2018 16:28:47 GMT
Gentlemen,

thanks for elucidation; am looking forward to 3 :)

As for the side debate

> (apart from that: Agree, never used that syntax in any language, never missed it in Groovy
due to functional constructs)

it used to get pretty handy in C; agreed that there's a little point for Groovy but for perhaps
some legacy stuff (which is also how I have happened to bump into that).

Thanks and all the best,
OC

> On 6 Aug 2018, at 5:11 PM, mg <mgbiz@arscreat.com> wrote:
> 
> 2.5.x does not use the new Parrot parser afaik, the upcoming 3.x and its now dormant
2.6.x JDK 7 backport do.
> 
> (apart from that: Agree, never used that syntax in any language, never missed it in Groovy
due to functional constructs)
> 
> -------- Ursprüngliche Nachricht --------
> Von: "Nelson, Erick" <Erick.Nelson@hdsupply.com>
> Datum: 06.08.18 15:10 (GMT+00:00)
> An: users@groovy.apache.org
> Betreff: Re: multi-declaration does not work in the for loop, groovy 2.4
> 
> Same in 2.5.1 from eclipse photon…
> 
>  
> 
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> 
> /Users/en032339/Documents/workspace3/script6/src/erick/erick.groovy: 6: unexpected token:
= @ line 6, column 14.
> 
>    for (int foo = 0, bar = 0; foo<bar ; foo++ ) {
> 
>                 ^
> 
>  
> 
> 1 error
> 
>  
> 
> …although I’ve never run into this before. Too many groovier ways to do loops in
groovy.
> 
>  
> 
>  
> 
> From: "ocs@ocs" <ocs@ocs.cz>
> Reply-To: "users@groovy.apache.org" <users@groovy.apache.org>
> Date: Monday, August 6, 2018 at 6:37 AM
> To: "users@groovy.apache.org" <users@groovy.apache.org>
> Subject: multi-declaration does not work in the for loop, groovy 2.4
> 
>  
> 
> Hi there,
> 
>  
> 
> I have just bumped into a — presumably — parser error, which causes that a declaration
of more variables is not accepted in a for loop:
> 
>  
> 
> ===
> 
> 44 /tmp> /usr/local/groovy-2.4.15/bin/groovy q
> 
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> 
> /private/tmp/q.groovy: 1: unexpected token: = @ line 1, column 13.
> 
>    for (int foo=0,bar=0;foo<bar;foo++)
> 
>                ^
> 
> 1 error
> 
> 44 /tmp> /usr/local/groovy-2.4.15/bin/groovy -version
> 
> Groovy Version: 2.4.15 JVM: 10.0.1 Vendor: "Oracle Corporation" OS: Mac OS X
> 
> 45 /tmp> 
> 
> ===
> 
>  
> 
> At the moment alas I can't test in newer groovys, not sure whether the problem is fixed
there or not.
> 
>  
> 
> All the best,
> 
> OC
> 
>  
> 


Mime
View raw message