Page 1 of 1

[a100] fat arrow modifying dynamic var in outer scope

Posted: 15 Nov 2018, 21:20
by sirksel
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.)

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

Posted: 16 Nov 2018, 03:18
by Helgef
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.

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

Posted: 16 Nov 2018, 06:39
by sirksel
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.

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

Posted: 16 Nov 2018, 06:44
by Helgef
Some more comments can be found :arrow: here.

Cheers.