Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Coding Style Guidelines


  • Please log in to reply
19 replies to this topic
S0und
  • Members
  • 100 posts
  • Last active: Apr 08 2015 10:07 AM
  • Joined: 16 Feb 2007

After using AHK for nearly three years, it is clear to me that most coders here favour capitalization, and so does the AHK help. Then why is it that many of these people choose NOT to capitalize certain keyboards such as if, else, return, while, but do capitalize most other keywords?


Currently i'm learning python which is case-sensitive, so to suck less in python i needed to stop capitalizing: if,else, but i still use autocomplite for every other command.

guest3456
  • Members
  • 1704 posts
  • Last active: Nov 19 2015 11:58 AM
  • Joined: 10 Mar 2011

After using AHK for nearly three years, it is clear to me that most coders here favour capitalization, and so does the AHK help. Then why is it that many of these people choose NOT to capitalize certain keyboards such as if, else, return, while, but do capitalize most other keywords?


if you look at the help file for each command, you will see that even ahk help suggests lower case for those keywords in the examples used:
http://www.autohotke.../commands/IfExpression.htm
http://www.autohotke...mmands/Else.htm
http://www.autohotke...ands/Return.htm

i keep these all lowercase as well, simply because they are CONTROL FLOW statements.

i use CamelCase for regular AHK commands/functions because that is how they are described in their respective help documents
http://www.autohotke...IfWinActive.htm
but also because i can quickly and easily differentiate what is a command/function and what is not

RaptorX
  • Members
  • 751 posts
  • Last active: Feb 19 2015 02:47 AM
  • Joined: 19 Feb 2010
Indeed I am one of those who capitalize first letter in commands (Msgbox, Gosub, Ifwinactive), camelcase functions (RegexMatch, OnMessage, StrLen) but lowercase keywords and variables (if, else, break, continue, a_desktop)... My own variables start with lowercase and then procede to camelcase (strLength, fstLetter).

That makes me be completely aware when I am coding... its kind of a wake up tactic to know exactly what I am doing at every moment.

It was difficult at first but now Im so used to it that reading other peoples code gets to the point of being annoying :???:
AutoHotkey Toolkit [Main Project]
Scintilla Wrapper
LexAHKL

RaptorX
  • Members
  • 751 posts
  • Last active: Feb 19 2015 02:47 AM
  • Joined: 19 Feb 2010

I had trouble getting past the first chapter.


I like reading an instruction guide that tells you what to do and then insults you (and your code) if you don't like it. :wink:


This is a short document describing the preferred coding style for the
linux kernel. Coding style is very personal, and I won't _force_ my
views on anybody, but this is what goes for anything that I have to be
able to maintain, and I'd prefer it for most other things too. Please
at least consider the points made here.


AutoHotkey Toolkit [Main Project]
Scintilla Wrapper
LexAHKL

Scoox
  • Members
  • 194 posts
  • Last active: Jun 09 2017 03:34 AM
  • Joined: 28 Nov 2010
RaptorX's method makes a lot of sense actually. I guess I never thought about it because my text editor has syntax highlighting for AHK, but I can see how it would be useful in a situation where all I have is Notepad. I think I'll give it a try in my next script.

RegJump() - Jump to registry path in Regedit

HoverScroll() - HoverScroll() - Scroll controls without focus