cross-stack globals, also, file inclusion
rjb at rz.uni-potsdam.de
Tue Oct 21 16:43:54 EDT 2003
>On Tuesday, October 21, 2003, at 12:53 PM, Dar Scott wrote:
>>On Tuesday, October 21, 2003, at 12:39 PM, Alex Rice wrote:
>>>global constant kVersion=1.234
>>>and have kVersion be so defined in script in the entire project.
>>Hmmm. This will require a decision on what is done if there is a
>>conflict since all scripts are compiled independently. Would this
>>also require all scripts to be compiled before execution can start?
>>Or are you thinking this would only be in the primary stack script?
>I don't think it is that problematic- just think of it as a global
>that cannot be changed. I guess it would have to be defined in the
>mainstack script though.
Since we have local vars and local constants, having a global
constant would complement the global vars. Although I am not sure
whether the benefit is really that important, there may be situations
that these are as useful as local constants. However, quite often,
using custom properties does the same and is easier to manage since
no initialization and preservation are needed.
It seems that the original poster, as I recall his problem, should
consider making his sub-stacks as true substacks of his primary stack
so he has a single physical file to deal with. This would eliminate
the issue of location tracking. If there is a real reason to keep
those sub-stacks as completely independent stacks (they could also be
plugin-like stacks that are in predefined location relative to the
primary), then their last location can be stored as a custom
property. And so can each sub-stack store the last used path of the
primary stack. If the info is missing or the stack is not at its last
location, a dialog can pop asking user to locate it.
More information about the Use-livecode