PhilHibbs Posted March 23, 2010 Share Posted March 23, 2010 What's with the underscore prefixes in function names? What is the convention? I initially assumed that it was reserved fro AutoIt official use, such as the UDF library, but I sometimes see people post scripts with their own functions with an underscore prefix. If I write a generic useful routine, should I prefix it with an underscore to indicate that it is a library routine and isn't necessarily part of a specific script? Link to comment Share on other sites More sharing options...
Fulano Posted March 23, 2010 Share Posted March 23, 2010 As far as I can tell it's a convention. Usually I will omit it because I dislike typing that character (it's a bit of a stretch for me), and it hasn't hurt my function. Generally I will use it if I am modifying someone else's code for a forum post, but outside of that it's very rare for me to use it. #fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja! Link to comment Share on other sites More sharing options...
JRowe Posted March 23, 2010 Share Posted March 23, 2010 http://www.autoitscript.com/forum/index.php?showtopic=109853Function Names All function names must start with an underscore (“_”). * Each word in the function name should be capitalized. The first word of the function name should start with a word describing a general category such as “Date”, “String”, “Array”, “Network”, etc.. If the word is too long like “Window”, then an obvious abbreviation may be used (e.g. “Win” for “Window” or “Net” for “Network”). All function names must closely resemble the established naming convention for "internal" AutoIt functions.People tend to use that convention for general use UDFs, but it's by no means a universal thing. If you want your code to fit in to the official AutoIt standards, then use those conventions.Consistency is probably more important than conformity in a large body of code, so use what you're comfortable with, unless it's something that a lot of AutoIt people are going to use. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now