Re: scope of variables
- Posted by coconut Dec 30, 2010
- 2920 views
I desagree with you on this. The rules of lexical scoping are so that you can define a variable of the same name inside narrower scope and this new variable will shadow the outer one.
integer a procedure foo() integer a -- this is accepted and this new 'a' shadow the outer one. ... end procedure -- the same should be true with this while 1 do integer a -- this should be accepted and shadow the 'a' at top level. ... end while
look at others languages that implement scoping at block level (at think lua does) and you'll see that it is done as I says.
Jacques