[ nice-Bugs-875242 ] for(i:1..10) i already defined

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.lang.nice.devel
Message-ID <[email protected]>
Bugs item #875242, was opened at 2004-01-11 18:01
Message generated for change (Comment added) made by igouy
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=875242&group_id=12788

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Isaac Gouy (igouy)
Assigned to: Nobody/Anonymous (nobody)
Summary: for(i:1..10) i already defined

Initial Comment:
void main(String[] args){
   int i = 1;
   for(i = min; i <= 10; i++) {}

   for(i : 1..10) {} // line 5
}

\Nice\Test\..\test\test.nice: line 5, column 8:
Symbol i is already defined.
Previous definition: \Nice\Test\..\test\test.nice: line 2, 
column 8

This goes against my expectations ;-)

   int i = 1;
   for(i = min; i <= 10; i++) {}
doesn't give an error 'i is already defined'







----------------------------------------------------------------------

>Comment By: Isaac Gouy (igouy)
Date: 2004-01-12 07:37

Message:
Logged In: YES 
user_id=536291

>for (i : 1..10) {} is the same as for (int i : 1..10) {} 

It doesn't *look* the same.
It looks the same as for (i = min; i <= 10; i++) {}

But that isn't really what I find confusing.
Actually I think this the local method variables discussion all 
over again - guess I'm just used to variable definitions being 
shadowed.



----------------------------------------------------------------------

Comment By: Arjan Boeijink (arjanb)
Date: 2004-01-12 06:31

Message:
Logged In: YES 
user_id=688815

This isn't a bug I think.
for (i : 1..10) {} is the same as for (int i : 1..10) {} so
int i = 1;
for (i : 1..10) {}
gives a error just like
int i = 1;
for (int i = min; i <= 10; i++) {}

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=875242&group_id=12788


-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.