I think Julia implicitly assume that i is a global variable, i.e. your 
function is equivalent to

f = () -> begin
    global i
    return i
end

So it compiles but throws an error at run-time if i is not defined in the 
global scope.

Reply via email to