To make your proposal useful, it should include examples of existing libraries that could make use of this syntax, along with specific examples of how the syntax should look. It's hard to justify (vaguely undefined) new syntax features that will only be used by non-existent libraries.
But in actual fact, there are at least two scripts handling mouse gestures, probably more. Mine gets by just fine with normal labels (
: syntax "extensions"). I'm fairly certain voice recognition has been done as well. If there's anything stopping people from handling multi touch, Hololens or anything else, it's probably lack of expertise or motivation, definitely not lack of integration with the
:: syntax.
OnClipboardChange, OnMessage and OnExit are just functions, using ordinary function syntax and callbacks/function objects. Their usage is similar to OnEvent (Gui), and can be emulated by script fairly easily. Integrating these types of events into the
:: syntax would
not remove the need for these functions. That should be obvious, since we already have
OnExit: and
OnClipboardChange: in v1, and we still need the
Hotkey function and recently added
Hotstring function despite having
:: syntax for those.
Two user defined function or class libraries are much more likely to be usable within the same script than two language extensions which try to utilize the same syntax.
The
:: syntax is based on label syntax, and has the drawback of being unable to clearly define the bounds of the associated procedure or establish a scope for local variables. (Using braces is currently no better than using comments, since execution passes through them.)
The advantage of the
:: syntax is that it is easy to get immediate, useful results. Even with integration, at the very least, the user would need to #include the appropriate library to enable whatever type of event they're trying to catch. The user then also needs to know (or look up) how to write the
:: line for whatever they're trying to handle, vs. how to do the same with a function or method call (which should also be an option anyway).
In another language, everything might be done with just call statements and blocks. For example,
Code: Select all
hotkey "#n", {
run "notepad"
}
onexit {
msgbox "Script is exiting"
}
msgbox "Script initialized"
Each type of event just needs a function to register for that event. Anyone can write a function.