On Apr 27, 2018, at 1:03 PM, Jody Bevan wrote:

> I would suggest if you are going to write something this far, why not make it 
> so that it will declare all local variables for you, and remove declarations 
> that are no longer needed. A great time saver. Of course to go that far, 
> there needs to be a strictly enforced naming convention.

That is exactly what I did. My naming convention is to suffix the type to all 
variable names. A text variable name could be “$name_t”, an ARRAY TEXT could be 
“$name_at”, etc.  Then I have a macro that will grab the current method text, 
parse it, build all the compiler directives for me and put them on the 
pasteboard. 

So my method creation workflow is to write the method. Don’t declare any 
variables. When I’m done writing the method and I’m ready to run it for the 
first time to test it, I run the macro and get my C_TEXT, C_LONGINT, ARRAY TEXT 
etc. declarations and I paste that at the top of the method. Done.

If I make changes to the method and use more local variables, I delete the 
local variable compiler declaration block and run the macro again. 

One advantage is you can easily spot any typos in variable names. Just scan the 
declarations and if you see “$ii” you’ll know you made a mistake and go find 
“$ii” and change it to “$i”. You get the idea.

This saves me a lot of time and makes it easy to always compile with all 
variables typed.  

Tim

*****************************************
Tim Nevels
Innovative Solutions
785-749-3444
[email protected]
*****************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to