Not sure if it's a bug when the parenthesis are omitted when the function call has []
Code: Select all
a := []
a.push "test"
MsgBox a[1]
m := Map()
m['a'] := []
m['a'].push "test"
MsgBox m['a'][1]
Code: Select all
a := []
a.push "test"
MsgBox a[1]
m := Map()
m['a'] := []
m['a'].push "test"
MsgBox m['a'][1]
+1
Parentheses can also be omitted when calling a method in this same context, but only when the target object is either a variable or a directly named property, such as myVar.myMethod or myVar.myProp.myMethod.
Source: Scripting Language | AutoHotkey v2
Exactly where and how might a user find such a note? The "Function Call Statement" section (quoted above) already explicitly states the conditions under which parentheses can be omitted. Is there some other part of the documentation which might lead the user to believe they can call a method without parentheses?If it isn't a bug a 'Common source of confusion:' note should be added to the docs.
IMO, all of that can be should have been eliminated in v2 to avoid confusion. But that did not happen, It therefore makes no sense to continue discussing it.If the return value of the function is not needed and the function name is written at the start of the line (or in other contexts which allow a statement, such as following else or a hotkey), the parentheses can be omitted.
We weren't discussing it, were we? I didn't bring it up.
I completely agree.To avoid such errors you've always the option of not using the can bes.