cross-stack globals, also, file inclusion

Martin Baxter martin at
Sat Oct 25 18:54:21 EDT 2003

>Martin Baxter wrote:
>> 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.
> Richard Gaskin wrote
>True, and for the extremely rare case where one is making a lot of
>references to a constant I suppose the extra time for the lookup might even
>become noticeable.   But if I'm not mistaken the time differerence for
>calling an accessor is very, very small (fraction of a millisecond?), so in
>most usages wwould have no material detriment.

Agreed, and I'd better make it clear that I'm not knocking accessors,
they're convenient and I use them myself. Anything can be used stupidly or
intelligently. Speed is no longer the big issue that it once was, but that
doesn't mean that code efficiency is suddenly a non-issue that we don't
have to worry about anymore.

To be honest that isn't a massive issue for me personally, I just thought
it was worth mentioning. My concern is a bit more philosophical. I'm used
to using such a thing in other languages of course and frankly I miss the
plain simplicity of being able to define my own global constants when
that's what the values actually are - constant and used globally - the
construct fits my intent and I don't have to hammer nails with a
screwdriver. (I'm trying to give that up you see ;-)


More information about the Use-livecode mailing list