Can a constant be global?
rcozens at pon.net
Mon Mar 27 10:28:32 EST 2006
David, Graham, et al:
> As far as I know, constants are only valid in the current script.
> Globals are really "Global" but then they can't be initialized to a
> value when they are defined, which is why I assume constants can't be
There is little to be gained by declaring a constant as global, because
both globals and constants must be declared in each script that
Globals can be initialized:
put 2*3.1416 into twoPi
But they can also be changed by any handler at runtime.
> The only way I have found to make constants "Global" is to make and
> use a Library Stack that becomes a sort of poor man's constant.
Note that this approach generates runtime activity, whereas a true
constant is a compiler instruction that only comes into play at
What I do is declare all constants in the library:
constant sdbConstant1= [constantValue]
constant sdbConstantn= [constantValue]
Then I copy the declarations for those constants referenced in a
specific script into that script.
constant sdbConstant6= [constantValue]
constant sdbConstant51= [constantValue]
constant sdbConstant187= [constantValue]
Just what Graham is trying to avoid having to do.
CCW, Serendipity Software Company
"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."
from "The Triple Foole" by John Donne (1572-1631)
More information about the Use-livecode