Helgef wrote: ↑22 Jan 2019, 01:44
() =>
expr
kk. it requires explicit use of
() for function calls inside fat arrow expr. I skipped them in a haste and didn't even realize there is a difference. In a normal method body with 1 line per built-in function it accepts it w.o
(). I would prefer expression evaluation tell me about if some var has a name as a built-in function instead of just failing silently.
Code: Select all
class1.func1()
class1.func2()
class class1{
func1(){
ListVars
Pause
}
static func2:=()=>(ListVars(), Pause())
}
If I combine built-in function calls in 1 line:
It raises an error:
Function calls require a space or "(". Use comma between parameters
BUT
For fat-arrow's body it fails silently. So the issue persists tho in another form. ![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Due to that unexpected difference using
static func2:=()=>(ListVars, Pause) I fell into thinking
ListVars simply fails inside fat-arrow.
PS: Please understand me correctly: writing
ListVars is unusual to me, I write something like this for one-time breakpoints for debugging just for brevity, I do use
() for every function call normally, e.g. I always write
ExitApp() instead of
ExitApp and for the majority of expressions, e.g.
return(var). Just b/c its a good programming style and it does simplify cross-language programming.
But if I missed
() by mistake I would expect the expression either
a) work as if
() r in the place (bad but thats how AHK and high-level interpreters work in general) or
2) give me some hint of error.
Helgef wrote:
There is nothing wrong with #warn, when a function is assume global it has no locals with the same name as a globals.
Thats right. Its not
#warn misbehavior, the cause of it is inability to change assume-mode for fat-arrow expression. But as a matter of fact I cant find a way to control correctness of my namespace.