FastClosures.jl icon indicating copy to clipboard operation
FastClosures.jl copied to clipboard

Nested do blocks do not work

Open jw3126 opened this issue 5 years ago • 2 comments

using FastClosures
outer = [[1]]
@closure map(outer) do inner
    map(inner) do x
        x + 1
    end
end
UndefVarError: x not defined

The reason is, that @closure thinks x is a variable from outer scope:

quote
    let x = x
        map(outer) do inner
            map(inner) do x
                x + 1
            end
        end
    end
end

jw3126 avatar Jun 09 '20 07:06 jw3126

Correct, this is a bug, thanks for the report.

c42f avatar Jun 13 '20 02:06 c42f

Any kind of nested structure doesn't work

_c = 5
@closure (_a) -> ((_b) -> _a+_b+_c) 

This gives an error that _b should be defined

JTaets avatar Jan 05 '22 09:01 JTaets