1. if fat-arrow returns Func it has to be in assume-local mode! Simple as that.
2. fat-arrow Func ignores local keyword:
Code: Select all
t:="unchanged"
Unix()
msgbox(t)
Unix()=>(local, DllCall("GetSystemTimeAsFileTime", 'int64p',t), t//10000000-11644473600)
4. declaring methods (and get/set halfmethods) via fat-arrow syntax is undeveloped. We cant just use name()=>: for methods:
Code: Select all
class classname{
methodname()=>(var:=1)
}
Accidentally I found this weird behavior of AHK L v2.
as expected first method func1 doesn't change a variable outside its scope.
but whats going on with the second method func2 defined as fat-arrow method inside the class? Isnt it expected t var to be local here?
Am I missing something?
Code: Select all
t:="not changed"
s1:=class1.func1(), msgbox(t) ;="not changed"
s2:=class1.func2(), msgbox(t) ;="2"
msgbox(s1 " | " s2) ;="1 | 2"
class class1{
func1(){
t:=1
return t
}
static func2:=()=>(t:=2)
}
And the syntax - I might be wrong but it feels somewhat inconsistent.
I can write func3()=>(t:=2) as a closure definition inside methods but
outside methods inside class it requires additional := and static word: static func3:=()=>(t:=2)