#if in C and C++ is a preprocessing directive. Preprocessing is already feasible. In fact, the (perpetually?) unfinished next release of Ahk2Exe supports
limited forms of the directive already, with
;@Ahk2Exe-IgnoreBegin...
;@Ahk2Exe-IgnoreEnd equivalent to
#if !A_IsCompiled...
#endif and
/*@Ahk2Exe-Keep...
*/ equivalent to
#if A_IsCompiled...
#endif. Evaluation of a constant expression, such as what C's #if allows, is also feasible; multiple methods of expression evaluation have been demonstrated over the years.
#if creates more work for developers because the developer needs to write both sides of the branch.
The extra work is put in only to achieve something that otherwise wouldn't be feasible, or would be achieved by some other means with (perhaps) even more work. #if does not create more work; writing one or both branches of the #if is just part of the work done to achieve some goal.
For instance, having #if in C++ does not create more work for me. Having multiple build configurations which utilize #if - ANSI/Unicode x86/x64 exe/SC - creates more work. Without #if it wouldn't be worthwhile, and you would have only Unicode 32-bit exe (or perhaps the original ANSI build).
As should be evident if you consider how AutoHotkey itself uses #if, there are more uses to it than just supporting multiple versions of AutoHotkey. An author could use it for whatever purpose they want.
It should be obvious that it is
not necessary to write both sides of the branch, just as it is not necessary when using
if (expression).
#ifdef or
#ifndef is oftentimes used without
#else.
While I recognize the utility of #if/#ifdef, I personally have no interest in implementing it at this time.
AutoHotkey v2 aims, to an extent, to minimise the number of AutoHotkey v1.1/v2 two-way compatibility issues.
Compatibility is mainly a side-effect of a number of other factors, such as the value I put in reusing familiar constructs rather than requiring new ones to be learned, the cost of change being greater than the cost of doing nothing, and general resistance to change where the value of that change is unclear.
AutoHotkey v1.1 aims, to an extent, to facilitate writing code that is forwards compatible with AutoHotkey v2.
Each and every new release aims to improve the program in some way. It is only natural that at least some of the changes which can be made to both versions are made, as long as I have any motivation to work on v1.1.