Re: scope of variables
- Posted by jeremy (admin) Dec 31, 2010
- 2639 views
jimcbrown said...
integer i function s() integer i = 1 return i end function
This is a very poor example which does not state reality, well maybe reality in a very poorly coded program. Why would there be a top level i variable? A more meaningful example would be something such as:
sequence current_filename = "john.txt" function get_token() sequence current_filename = "jim.txt" abc_xyz() end function
This goes back to proper variable naming. However, I can see I'm fighting a loosing battle. People want the ability to shadow poorly named variables. To me, it's very unfortunate that we allow such bad practices for no benefit.
Jeremy