Scripting Style (was re: array info request)
Richard Gaskin
ambassador at fourthworld.com
Mon Jul 25 19:18:16 EDT 2005
Scott Rossi wrote:
> Another consideration -- assuming that at least 99 percent of developers
> code in lower case, line 1 below might appear to be more ambiguous than line
> 2:
>
> put 25 into a
>
> put 25 into A
>
> IMO, line 1 has the *appearance* of an incomplete script, while in line 2,
> there *may* be missing script but the upper case character is a clue that
> "A" was intended as a variable name.
But neither would be optimal as "a" is a reserved token (used as part is
the "there is a" operator). Oddly enough the compiler accepts it, but I
try to avoid reserved tokens; I could have sworn I'd run into a case
where using "a" as a var name gave me trouble, but I can't reproduce it now.
Point taken just the same. To help make things more visually distinct I
usually start my custom handlers with an upper-case letter, and leave
built-in calls starting with lower-case, e.g.:
on mouseUp
global gMyVar
set the title of this stack to MyFunction()
DoSomething
put version() into gMyVar
end mouseUp
The assumption is that it's more likely that the things that break will
be mine more often than the engine's <g>, so I make mine stand out to be
easier to find when skimming.
--
Richard Gaskin
Fourth World Media Corporation
__________________________________________________
Rev tools and more: http://www.fourthworld.com/rev
More information about the use-livecode
mailing list