Make Constants Defined in a Procedure Local
Posted: Thu Sep 17, 2015 6:43 pm
When a constant is defined in a procedure, the constant should only be available in that procedure. Similar as it is with labels (was implemented kind of recently).
One of the reasons is that it doesn't make much sense the way it is right now:
The other reason is that I like to put certain constant values, only used for one calculation or whatever, in constants (to increase readability). Unfortunately it often doesn't work:
...And please don't tell me that I should rename those constants to "fix" the issue. 
One of the reasons is that it doesn't make much sense the way it is right now:
Code: Select all
#Global = "Global Constant"
Procedure Test()
#Local = "Local Constant"
EndProcedure
Debug "Global: " + #Global ; Ok
Debug "Global: " + #Local ; Doesn't make sense!
Code: Select all
Procedure CalcThis()
#ITERATIONS = 10
#MAX_VALUE = 999
; [...]
EndProcedure
Procedure CalcThat()
#ITERATIONS = 10000 ; Doesn't work :(
#MAX_VALUE = 1.0
; [...]
EndProcedure
