explicitvariables weirdness

Eric Chatonet eric.chatonet at sosmartsoftware.com
Tue Oct 24 10:17:53 CDT 2006


Hi Mark,

You could have a look at http://www.fourthworld.com/embassy/articles/ 
scriptstyle.html where Richard wonderfully explains many things about  
that:
"You go back to it six months later to add new features or better  
error-checking, and you have no idea what you were doing. It's  
spaghetti code"

I always prefix local variables with a "t" (as globals with a "g",  
scripts variable with a "l", constants with a "k" and custom props  
with a "u") and always use meaningful names.
If you use precise naming conventions falling within the scope, it  
becomes very consistent... and help a lot later.
Here is one I use that you will not find in the above article:
When a handler calls another handler  or a function I put a special  
and short comment at the end of the line to tell me where is this  
handler or function (I have projects with thousands lines of code  
that use many libraries and independent stack files and if I had not  
this reminder I would spent my time searching all around.
But I would understand that people don't agree with this ;-)

Le 24 oct. 06 à 15:37, Mark Swindell a écrit :

> Eric, I'll try to get into this habit if it's considered good form,  
> but since I already use the gGlobal convention, I can identify  
> local variables easily enough.  If there's no g in front, it's  
> local, and by context it's a variable, no?  Where does it become  
> problematic in interpreting undeclared locals?

PS. You are right: context should be enough to distinguish any variable:
put the formattedWidth of me div  the width of me into scale
Unfortunately, scale is Linux property of EPS objects within Rev...
Using tScale, you have not to ask yourself ;-)

HyperCard allowed to not declare local variables (actually did not  
accept local variables declarations) and MetaCard took it up.
But in most programming languages, all variables must be declared.
I think it's clearer.

Best Regards from Paris,
Eric Chatonet
------------------------------------------------------------------------ 
----------------------
http://www.sosmartsoftware.com/    eric.chatonet at sosmartsoftware.com/





More information about the use-livecode mailing list