That would require something like:derz00 wrote:I don't understand why directives do not use expression syntax. Maybe it has been discussed somewhere.
- parsing and evaluation of expressions before the script starts executing, perhaps even before the script's structure is actually valid;
- parsing and "evaluation" of a very limited subset of expression syntax; or
- some other fundamental change to how directives work.
- #MaxThreadsBuffer, #SingleInstance, #UseHook and #Warn take one or more keywords, and there seems no reason to allow built-in variables (non-built-in variables would be empty). "Expression syntax" would be just adding quote marks.
- Likewise for #MenuMaskKey, except that it takes a key name (including vk/sc syntax, so not really one from a list of keywords).
- #If accepts an expression, but the expression isn't evaluated until later, such as whenever a hotkey is pressed.
- #Hotstring accepts keywords and possibly a list of symbols. Using expression syntax here complicates that.
- #Include/Again accepts a library name or path, with optional variables. It would probably be better to interpret a subset of expression syntax, although an explanation of this subset may be more complicated than the current documentation. "Enclose variables in percent signs" is very straight-forward, and fairly familiar, both because of v1 and because of environment variables used in paths. (But maybe that also implies some risk of confusion, since it doesn't accept environment variables.)
- #SuspendExempt (which was added for v2) accepts a subset of expression syntax (literal True, False, 0 or 1).
- All other directives have no parameters or accept literal numbers; again, a subset of expression syntax.
Basically, the cost (in terms of development time and increase in code size) versus practical benefit does not seem favorable, especially while there are more important and interesting things to work on. However, I will probably change them before the v2.0 release.