Can a constant be global?

David Burgun dburgun at dsl.pipex.com
Mon Mar 27 11:52:45 EST 2006


Hi Jim,

I used to use this method, but found that it was too easy to  
overwrite the values. At least with the LibConstant approach they are  
*really* constant.

All the Best
Dave


On 27 Mar 2006, at 17:49, Jim Ault wrote:

> You could have fields on a card in a lib stack that hold the constant
> values, then access them from any stack.  In fact, the  
> 'contantsVals.rev'
> stack does not even have to be open.
>
> A lib function could retrieve the value in any handler without  
> having to
> declare 'globals'
>
> Jim Ault
> Las Vegas
>
>
> On 3/27/06 8:42 AM, "Graham Samuel" <livfoss at mac.com> wrote:
>
>> 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
>>> variables.
>>
>> 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
>>
>>
>> ----------------------------------------
>> Graham Samuel / The Living Fossil Co. / UK and France
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list