logo       

RE: standard for loop: msg#00198

lang.groovy.user

Subject: RE: standard for loop

But why don't you support Java syntax. One of the selling points
of groovy is that its easy to learn because it is Java plus a lot
of scripting features. Why don't you support all of Java? You
shouldn't leave out standard java syntax such as the for loop just
because groovy has a "better" way. I know the java for loop - I
have to learn the "groovy way".

In addition, groovy is gratuitously incompatible with java such as:

for(x in y){}

instead of

for(x : y){}

I use beanshell instead of groovy for a lot of scripting just because
I can start with Java and then use the scripting features I want.

I'd be interested in what the groovy developers have to say about this
general issue of java compatibility. Thanks.

Steve Buroff

> -----Original Message-----
> From: Dion Almaer [mailto:dion-4eS6uFwS6GLQT0dZR+AlfA@xxxxxxxxxxxxxxxx]
> Sent: Tuesday, November 30, 2004 12:26 AM
> To: user-i9PBDF1N6cxnkHa44VUL00B+6BGkLq7r@xxxxxxxxxxxxxxxx
> Subject: RE: [groovy-user] standard for loop
>
> You can do something cheeky like:
>
> for (i in 0...foo.size()) { println i }
>
> Dion
>
> -----Original Message-----
> From: Scott Stirling [mailto:scottstirling-KealBaEQdz4@xxxxxxxxxxxxxxxx]
> Sent: Monday, November 29, 2004 11:17 PM
> To: groovy user
> Subject: [groovy-user] standard for loop
>
> Hi,
>
> Is there a Groovy idiom (with a counter) to use instead of a
> standard 'for'
> loop? I need to use the counter from the loop iterations.
>
> I get this exception when I code a standard 'for' loop (i.e.,
> for (int i =0;
> i < foo.size(); i++):
>
> Exception in thread "main" NOT YET IMPLEMENTED: standard for loop
> at
> org.codehaus.groovy.syntax.parser.ASTBuilder.forStatement(ASTB
> uilder.jav
> a:1026)
> at
> org.codehaus.groovy.syntax.parser.ASTBuilder.statement(ASTBuil
> der.java:
> 773)
> at
> org.codehaus.groovy.syntax.parser.ASTBuilder.topLevelStatement
> (ASTBuilde
> r.java:327)
> at
> org.codehaus.groovy.syntax.parser.ASTBuilder.build(ASTBuilder.
> java:198)
> at
> org.codehaus.groovy.control.SourceUnit.convert(SourceUnit.java:339)
>
> Thank you,
> Scott Stirling
> Framingham, MA
>
>
>




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise