. Re: cross-stack globals, also, file inclusion
J. Landman Gay
jacque at hyperactivesw.com
Sat Oct 25 11:32:44 EDT 2003
On 10/25/03 6:05 AM, Martin Baxter wrote:
> I'm no expert so correct me if I'm wrong, but as I understand it, constants
> are a structurally different kind of thing from variables, and there is a
> bit more to it than scripting style preference.
>
> 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.
I think this is more true for other languages than for x-talks. We'd
need Tuv or someone to verify it, but I believe that even constants need
to be evaluated each time they are used. For example, assume a constant:
constant x = 123
Now I could use that constant a number of ways in scripts:
add 1 to x
put x after myNumber
In the first case, x must be typed internally as an integer. In the
second case, x must be typed internally as a string. The compiler still
has to evalute and decide.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list