Polyester.jl
Polyester.jl copied to clipboard
UndefVarError: not defined
This code will result an error LoadError: UndefVarError: a#259 not defined.
using Polyester
function test()
a = zeros(3)
@batch for i in 1:3
if false
a = zeros(3)
end
a[i] = 1.0
end
end
test()
But it will be OK when I use Threads.@threads. Is it a bug?
Thank you very much.
Polyester tries very hard not to capture variables in closures.
The a = inside the loop tells it not to take any as from the surrounding scope.