. Re: cross-stack globals, also, file inclusion

Dar Scott dsc at swcp.com
Sat Oct 25 13:19:36 EDT 2003


On Saturday, October 25, 2003, at 11:07 AM, Stephen Quinn Barncard 
wrote:

> This is the best argument I've seen for global constants. I get it.
>
> sqb
>
>> The major difference I don't think anybody has mentioned is that 
>> since the
>> value of a constant is known at compile time, it can be inserted 
>> directly
>> into the resulting object code. So the value has only to be looked up 
>> once
>> - at compile time - whereas a variable always has to be re-evaluated 
>> at
>> runtime. A variable that's got from an accessor would seem to be even 
>> more
>> work because a handler has to be run to determine which variable to 
>> look up.

Doesn't this mean there should not be global constants?

If each script is independently compiled, how can the compiler know 
what the constants are?  If it can't know, it can't insert them into 
code.  (I actually have no idea how this is done at this time.  Since 
there is no constant simplification, I suspect this is not the case.)

I don't see how a compiled script can see a constant as other than a 
special global variable that cannot be changed.

Dar Scott



More information about the use-livecode mailing list