guest3456 wrote:Just the inconsistency for when its possible to do that.. only works Hotkey labels but not normal labels or hotstrings,
I find it hard to believe anyone would have trouble "predicting" that. The syntax for hotkeys is different to the syntax for labels and the syntax for hotstrings. It's not like the script will behave differently if you point a label or hotstring at a function - the program won't allow you to make that mistake.
I expect some users would use the new syntax, or any equivalent which allows local variables as easily, almost exclusively. I often avoid using variables in hotkeys because they're global, and defining and calling a function is too verbose. Defining the hotkey as a function also encourages self-documenting code, like
^a:: select_all() {....
and the differences for when things fall thru to new labels.
(I'll assume you meant "fall through labels", because "fall through to new labels" makes no sense to me.)
With normal hotkeys, labels and hotstrings, execution always falls through
the label, and this commonly causes problems because it doesn't also fall through the commands below the label. The exception is that the first hotkey or hotstring acts like
return; this inconsistency already exists, and the new feature does not change it at all.
Similarly, execution always falls through function definitions. This also hasn't changed. The only thing that has changed is that
hotkey:: followed by
function_definition() is interpreted as assigning that function to the hotkey, instead of raising an error.
I just don't see why this is needed in the language.
Don't you see the benefit of using functions? Requiring a function call and return for each hotkey is not conducive to using functions for every hotkey.
I will probably never use it for those reasons so perhaps others should be consulted
Considering only the opinions of users who would use the feature would bias the result rather unreasonably.
I'm not dead set on including the feature; as I said, it's experimental. I'm just very surprised to see such direct opposition to it, or any opposition to it.
I also considered something like
^a::(), but it looks weird and doesn't make a lot of sense, since the hotkey never passes parameters (but some could be defined). It also wouldn't allow assigning several hotkeys or hotkey variants, or calling the hotkey-function from elsewhere.