"static" vs "script local" (was globals)
ambassador at fourthworld.com
Sun Sep 8 18:26:01 EDT 2002
Dar Scott wrote:
> On Tuesday, August 27, 2002, at 10:21 AM, Richard Gaskin wrote:
>> FWIW the revised Script Style Guide was updated to include
>> reference to this new variable type:
> I have a few minor concerns with the terminology of "static" for
> "script local" variables in Revolution.
> I don't think one new to Revolution might always have heard of
> "static", "automatic", "dynamic", "scope", "extent" and the like in
> the jargon of computer science.
Many things in programming require learning, all the way down to
understanding the difference between "repeat until" and "repeat while".
Variable scope is one of these. Picking a good term for each type of
variable is indeed important to learning.
"Static" is not my favorite term for script-local vars. This is similar to
"destroy", which has a specific meaning to a C++ programmer but the scripter
is often surprised to learn that "destroyStack" does nothing destructive to
their stack. For all the reasons you mentioned, "static" is worth avoiding
-- except in the absence of any alternative.
When I wrote the Script Style Guide (and all the way up through last week
when this thread began), people were confused by having two radically
different types of variables using the same declaration. In discussion
here, while the difference between "local" and "global" requires only a
single word to describe which type you're referring to, the distinction
between "local" and "local" required another sentence or two, as the term
from the Rev docs had not found its way into common usage.
Now that Jeanne has clarified the Rev's team's preference for "script
local", the 4W Script Style Guide has been updated to reflect this.
But given that the declarations "local" and "local" behave very differently
depending on context, it would be icing on the cake to have a different
declaration for each use. The term "script-local" is useful in conversation
but absent from the Transcript language. While the distinction in usage
can be inferred, it would be even simpler if it were explicit. I'm not
arguing in favor of "static" simply because that's how VB does it (someone
call 911 if I start recommending "DIM" and "REM" <g>) as much as I'm simply
in favor of having unique declarations for unique usages.
But like I said, it's icing.
Whether it's delared as "local" or "static" or "scriptLocal" or something
else or simply called "bob", the important thing is the key role this new
variable type can play in simplifying code and encouraging code reuse. It
took me a while to get comfortable with them, but they've radically changed
my code style.
Fourth World Media Corporation
Custom Software and Web Development for All Major Platforms
Developer of WebMerge 2.0: Publish any database on any site
Ambassador at FourthWorld.com http://www.FourthWorld.com
Tel: 323-225-3717 AIM: FourthWorldInc
More information about the Use-livecode