Re: problems with the scoping in eu4
- Posted by mattlewis (admin) Jan 09, 2011
- 1766 views
Quoting Jayglade
think his point about reusing for-loop variables is that you cannot have a normal variable with the same name as the for-loop variable. It's related to the masking issue we've been discussing.
integer idx = 0 for idx = 1 to 10 do -- error! ? idx end for
Maybe kind of silly, but I think it and the block scope variable masking has a lot to do with all the namespace issues the dev team has been trying to fix/make sane since the beginning.
No: my point was that the for loop variable pollutes the outer namespace.
for i ... end for
for i ... end for <= is a re-declaration error
Masking is a somewhat separate issue as it is about being able to declare variables in nested scope
The for loop variable should not be accessible outside of the scope of the for. That should mean that separate non-nested fors should be able to use the same index name
Why do you keep saying this? Why do you believe this? I told you that it wasn't how euphoria works. Have you tried this? It's clear to me you have not. Are you simply trolling? Try this:
procedure main() for i = 1 to 2 do ? i end for for i = 3 to 4 do ? i end for end procedure main() main()
Matt