[a100] fat arrow modifying dynamic var in outer scope Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
sirksel
Posts: 222
Joined: 12 Nov 2013, 23:48

[a100] fat arrow modifying dynamic var in outer scope

15 Nov 2018, 21:20

Is there a limitation on fat arrow, which would not allow a function like (val, cnt) => var%cnt% := val to modify var1 ... var9, which are byref variables in the enclosing scope?

I've been trying to debug code, and have had success assigning to an outer scope array with identical code, so I'm guessing it's a known limitation. Correct? (Sorry if I overlooked it in the documentation.)
Last edited by sirksel on 16 Nov 2018, 06:32, edited 1 time in total.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: [a100] fat arrow modifying byref var in outer scope  Topic is solved

16 Nov 2018, 03:18

nested functions wrote:Dynamic variable references inside a nested function can resolve to variables from the outer function only if the nested function (or one of its own nested functions) also contains a non-dynamic reference to the variable.
Byref or not doesn't matter.
sirksel
Posts: 222
Joined: 12 Nov 2013, 23:48

Re: [a100] fat arrow modifying dynamic var in outer scope

16 Nov 2018, 06:39

That answers it perfectly, Helgef. I modified my thread title from "byref var" to "dynamic var" to make it more on-point with the real issue (dynamic, not byref) -- as you've helped me understand. Thanks.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: [a100] fat arrow modifying dynamic var in outer scope

16 Nov 2018, 06:44

Some more comments can be found :arrow: here.

Cheers.

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Archimede, Descolada, Giresharu, NPerovic, redrum, songdg and 20 guests