Hi, so here is an example of the type I was thinking of when I wrote that. Consider the following code:
function increase(n::Int)
return n+m
end
n = 5
m = 2
r = increase(n)
@show r
This code runs and outputs the number 7 as expected. However, when you look more closely at the code inside the function increase, you will see that the variable m there is not a variable that got passed into the function’s list of arguments. Yet the code still runs, because m is defined in global scope so the function can still access it.
It may not look like a problem for this simple code, but in more complicated codes when using certain variable naming conventions, so that the same variable name could appear more than once, across different functions, one could end up with surprising situations where there is global state across different functions.
Hope that helps. Similarly, in past versions of Julia, for loops would give strange results in global scope because of the special properties of global scope, however, in more recent versions of Julia that situation has been improved.
Miles