Can a constant be global?
livfoss at mac.com
Mon Mar 27 11:42:08 EST 2006
Recently, Robert Brenstein <rjb at robelko.com> wrote:
> RR's own constants are global because they are part of the language
> so do speak. As such, they are defined in the engine. That makes them
> a different beast than constant defined in your scripts.
> Replicating constant behavior at global level has been discussed
> quite a lot in the past, and not only on this list, but... it is a
> lot more complicated than it seems at first glance. So, for now at
> least, there is no way to make a global behave like a constant
> through declaration. It is up to you to designate some globals as
> global constants, like using a different prefix than for global
Yup, that's what I've always done in the past: I just thought
constant declarations might help, but clearly they won't - so I will
stick to the tried and true method. I don't think Dave Burgun's
'constant-value function' approach would gain me anything, because of
the way I want to cluster all the constants together in a script. As
I said, most of my 'constants' are in fact text strings, and I simply
run a 'setUpParameters' handler during the initialisation of my app
which sets them all (and a lot of other stuff besides, like menu names).
Thanks for the replies.
Graham Samuel / The Living Fossil Co. / UK and France
More information about the Use-livecode