ac and I have developed some new features to assist with debugging scripts. These can be enabled by using the new #Warn directive:
Some relatively low-level changes were required to make this possible, but behaviour of existing scripts shouldn't be affected. Note that if warnings are enabled, warnings may be given for certain situations which are valid (but not necessarily good style). For example:#Warn [v1.0.93.00+]
Enables or disables warnings for selected load-time or run-time conditions that may be indicative of developer errors, such as typos or missing "global" declarations.#Warn WarningType [, WarningMode]This is intended to be a developer tool that helps speed up script development by making such errors easily discoverable.
This feature is conceptually related to Visual Basic's "Option Explicit" setting and Perl's "Strict" pragma, though it only provides added-on warnings, rather than requiring any up-front changes to the script (such as explicit declarations for all variables).
[Read more on the #Warn directive.]
[*:w9dugi2v]Code like If !x or If x= is often used to determine if x needs to be initialized. In particular, this was necessary for static vars in older builds since static initializers did not support expressions. As these uses of x will generate a warning if x has not been initialized, it is recommended to explicitly initialize x to "" or 0, where appropriate.
[*:w9dugi2v]Sometimes a DllCall output parameter (with * or P suffix) is used to initialize a variable. However, since only the programmer and the function itself know if the input value is important, a warning is still raised if the variable was not previously initialized. To avoid this, the variable can be initialized inline: DllCall("SomeFunc", "IntP", outVar := 0).
[*:w9dugi2v]When used alone on a line, x += 1 treats blank values as zero. Because of this, some (working) scripts don't explicitly initialize x and will therefore receive a warning. Since this behaviour is likely to change in v2 (for consistency), users should get used to explicitly initializing x.Additionally, this release includes extensive changes to optimize file I/O, as in the previous test release:
(Download link removed; get v1.0.95 instead)To address some performance issues recently brought up here, I've made some extensive changes to the file reading and writing routines used by FileAppend, Loop Read, the File Object and script parser. Since these changes are so extensive, rather than immediately releasing a new version I thought I should first give everyone the opportunity to (cautiously) test it, and to catch any issues I may have missed.
Even just testing the scripts you use regularly may help, particularly if they contain non-ASCII characters.
Updated 2011-03-06: Mostly unrelated bug-fixes.
Updated 2011-03-07: #If A_PriorHotkey; improved auto-concat; Run *Verb now supports params.
Updated 2011-03-08: Fixed (x="" and y).