Okay, it seems that it’s not about whether the constructed function is a closure, but about how the global variable is embedded in the function body, which is even more confusing now:
julia> d = fill(1)
0-dimensional Array{Int64, 0}:
1
julia> function f3()
function (y)
d[] + y
end
end
f3 (generic function with 1 method)
julia> f3c = f3()
#3 (generic function with 1 method)
julia> f3c(1)
2
julia> d[] += 1
2
julia> f3c(1)
3
julia> f3c_dc = deepcopy(f3c)
#3 (generic function with 1 method)
julia> f3c_dc(1)
3
julia> d[] += 1
3
julia> f3c_dc(1)
4
julia> f3c(1)
4