AutoHotkey v2 alpha (UPDATES)

Discuss the future of the AutoHotkey language
Posts: 6652
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


09 Oct 2019, 05:52


Particularly important:

Removed the new operator; use

Changed objects to throw an exception when attempting to retrieve an undefined property.

Simplified SetTimer: removed "On"/"Off"/"Delete", the ability to disable/re-enable timers (which requires keeping them in the global timer list), and inconsistency between actual functions (Func) and function objects. Delete a timer by passing 0.

Changed hotkeys without #/! to never mask release of Win/Alt, rather than doing so only if Win/Alt is physically down (inconsistent with remapped Win/Alt keys).

Added IsSet(Var).

Added primitive types and Any to the type hierarchy. Added prototypes for Any, Primitive, String, Number, Integer and Float; not yet accessible except through a value of the applicable type. All values are based on Any (except ComObjects) and can use HasBase, HasProp, HasMethod and GetMethod, which are now also functions. Define/Delete methods can't be called directly on the prototypes as they are not derived from Object.Prototype.

Changed BoundFunc to merge parameter lists when bound args are omitted.

Changes and additions relating to DllCall (and native COM interfaces in particular):
  • Added Ptr property to VT_ARRAY, VT_BYREF and VT_UNKNOWN ComObjects, allowing them to be passed to DllCall more easily.
  • Added HRESULT return type for DllCall (throws on failure).
  • Added ComCall as a shortcut for calling COM interface methods.
  • Changed DllCall "str" to detect overwrite of null-terminator.
  • Changed Str*, WStr* and AStr* to output value of new pointer.
  • Changed DllCall Ptr*, Obj to assign to Obj.Ptr rather than Obj. This allows constructs such as DllCall(..., "Ptr*", unk :=, which reduces repetition and improves maintainability compared to DllCall(..., "Ptr*", punk), unk :=
  • Changed DllCall to throw if a numeric-type parameter is non-numeric. In particular, if the * or P suffix is used for output parameters, the output variable is required to be initialized. This improves robustness and compatibility with #Warn.
Changed internal use of Call to bypass __Call, and improved compatibility with COM function objects that handle DISPID_VALUE, such as JScript functions.

Changed FileOpen to throw an exception on failure.
Changed Object.New(with_params) to throw if there's no __New.
Changed concatenation with an object to produce an error.

Improved error-reporting for invocation of unknown property/method.

Fixed Menu prototype not inheriting from Object.Prototype.
Fixed debugger skipping enumerated items when properties are present.
Fixed For onevar in e to call e.__Enum(1) rather than e.__Enum(2).
Fixed CStringA buffers not being freed by DllCall if an exception is thrown.
Fixed handling of ComObj[] and ComObj.__Item.
Fixed incorrect error messages for x.y[z] when [z] is impossible.
Fixed issues with multiple arrow functions in the same scope.
Fixed Object() to throw when given an odd number of parameters.

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: No registered users and 13 guests