Re: scope of variables

new topic     » goto parent     » topic index » view thread      » older message » newer message
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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu