ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kev Jackson <kevin.jack...@it.fts-vn.com>
Subject Re: svn commit: r393996 - /ant/core/trunk/src/main/org/apache/tools/ant/launch/Launcher.java
Date Fri, 14 Apr 2006 07:20:11 GMT
Martijn Kruithof wrote:

> Hi,
>
> I think the while construct is cleaner and more readable, and do not 
> see any real benefit of this code change.
> Especially against using the for loop is that when using the for loop 
> the step of the loop should take place in the third part of the for, 
> and not somewhere inside the for loop.
>
My reason for the change was that with the while construct, the scope of 
the tokenizer variable is larger than is necessary - ie it is only used 
within the loop, yet it is declared outside the loop.

The idiom I was using when making this change is similar to

for (Iterator i = list.iterator(); i.hasNext();) {
  Stuff s = (Stuff)i.next();
 ...
}

Which is fairly common usage - ignoring the last element of the for

> What's the position of other committers on this?
>
I'd be interested to hear other opinions too, after all I only changed 
the code as I (perhaps mistakenly) thought that having a larger than 
necessary scope is generally a bad thing

> Martijn


Thanks for the comments

Kev


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message