I came upon this behaviour in the current 0.70-beta which surprised me a bit:
julia> f=open("basin.txt","r") IOStream(<file basin.txt>) julia> close(f) julia> for i=1:1 f=open("basin.txt","r") close(f) end ┌ Warning: Deprecated syntax `implicit assignment to global variable `f``. │ Use `global f` instead. └ @ nothing none:0 julia> typeof(f) IOStream
Is this just that the depreciation warning is triggered by accident (if was some “normal” variable it would of course be correct) or should I really use global or rename throw-away variables in 1.0 ? Or asking the more basic question: Is there a better way to introduce throw-away temporary variables ?
Also, I would have expected that f is no longer in existence (garbage collected ?) after closing.
Most file IO probably happens in functions and not in main scope, so this is probably quite some niche case.