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 "Global".

There is little to be gained by declaring a constant as global, because both globals and constants must be declared in each script that references them.

Globals can be initialized:

        global twoPi
        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 compilation.

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.

Rob Cozens
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)

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to