Re: scope of variables
- Posted by jeremy (admin) Dec 30, 2010
- 2947 views
coconut said...
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. 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.
Various languages do this. Euphoria is not one of them. Maybe it should be brought up for discussion as to make it do this in a future version but as of 4.0 this is not a bug, it is its design. I personally feel that shadowing variables is a bad idea and shouldn't be used in code.
To start the dialog, in what situation would it be beneficial to allow duplicate variable names of various types?
Jeremy