Page 1 of 1

Consistency:HasKey and variadic array paths

Posted: 13 May 2017, 10:42
by nnnik
Since some update it is possible to access objects and arrays via variadic syntax:

Code: Select all

value := array[ path* ]
This was one of the best things that has happened to AHK recently.
What I'm asking for is that .hasKey( key ) should reflect this change.

What I'm asking for is that every path that you can put inside the [ ] after an array the same path input in the same way into .hasKey should produce a result:

Code: Select all

arr[]         : arr.hasKey()
arr[key]    : arr.hasKey(key)
arr[x,y]    : arr.hasKey(x,y)
arr[path*] : arr.hasKey(path*)
I think this sort of consistency would really make things easier to program and to understand.
I do already know several solutions to this that you need to use depending on the occasion.