julia-vscode / StaticLint.jl

Static Code Analysis for Julia
Other
147 stars 27 forks source link

Scope/closure ref issue #291

Open pfitzseb opened 3 years ago

pfitzseb commented 3 years ago
function readfile(svname)
    algrtm="unknown"
    rbc="unknown"

    open(svname) do io
         algrtm = readuntil(io,'-')
         readline(io)
         rbc = readuntil(io,'-')
    end

    return algrtm, rbc
end

image

frankier commented 2 years ago

This is quite a bad one, because it tricks people into thinking they have not understood how Julia scoping works, when actually they have.

There's even discussion here about how Julia's implicit scoping behavior -- not having a nonlocal keyword versus Python might trip people up. This lint will have people coming for Python fumbling for nonlocal, but not find anything.