Post by jeeswg » 11 Apr 2018, 15:58
I had thought that I might do a (personal) style guide at some point. Well, I've done one now. All are welcome to contribute.
your personal AutoHotkey style guide - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 17&t=47140
• No {} for single lines after if
[Fine. I might do it occasionally.]
• No . for concat
[Fine.]
• No unnecessary commas
[I prefer to use commas, it looks better IMO, and makes it clearer whether the first parameter is/isn't omitted.]
Code: Select all
;initial commas
MouseGetPos, vCurX, vCurY, hWnd, vCtlClassNN
MouseGetPos,,, hWnd, vCtlClassNN
;no initial commas
MouseGetPos vCurX, vCurY, hWnd, vCtlClassNN
MouseGetPos ,, hWnd, vCtlClassNN
• No quoted numerals
[Fine.][Btw sometimes you need to quote numerals e.g. var := "012".][If I intend to use it as a string, I might define it as a string, possibly there would be a speed gain, if you avoid repeated conversion between types.]
• No unnecessary () in if-expressions
[Fine.][I'm not actually 100% sure when you can/can't omit the parentheses.]
I had thought that I might do a (personal) style guide at some point. Well, I've done one now. All are welcome to contribute.
your personal AutoHotkey style guide - AutoHotkey Community
[url]https://autohotkey.com/boards/viewtopic.php?f=17&t=47140[/url]
• No {} for single lines after if
[Fine. I might do it occasionally.]
• No . for concat
[Fine.]
• No unnecessary commas
[I prefer to use commas, it looks better IMO, and makes it clearer whether the first parameter is/isn't omitted.]
[code]
;initial commas
MouseGetPos, vCurX, vCurY, hWnd, vCtlClassNN
MouseGetPos,,, hWnd, vCtlClassNN
;no initial commas
MouseGetPos vCurX, vCurY, hWnd, vCtlClassNN
MouseGetPos ,, hWnd, vCtlClassNN
[/code]• No quoted numerals
[Fine.][Btw sometimes you need to quote numerals e.g. var := "012".][If I intend to use it as a string, I might define it as a string, possibly there would be a speed gain, if you avoid repeated conversion between types.]
• No unnecessary () in if-expressions
[Fine.][I'm not actually 100% sure when you can/can't omit the parentheses.]