I've just updated Julia to v1.6.3 from v1.5.0 in Atom, and I'm running Julia in some script.jl file (I'm using shift+enter to run the highlighted code). According to Julia's documentation, for both two versions,
So (if I understand the doc correctly) if you already have a global variable named x, and if you try to assign value to variable x in a for loop (which creates a soft scope) in non-interactive context, Julia will create another local variable x and the original global variable x would not be modified.
But I noticed same lines of code yield different outcomes in v1.5.0 and v1.6.3, the lines of code are as follows:
x = 0
for i = 1:10
x += 10
end
In v1.5.0, it would give me error saying "UndefVarError: x not defined", which makes sense since in the soft scope (within for loop), it would create a new local variable x, but we didn't assign value to this new local variable. But in v1.6.3, the code works out fine and x got change in global scope as well. I'm guessing instead of creating a new local variable x, it uses the global variable x and assigns value to that.
But I'm still not sure exactly what happened here, does this mean in v1.6.3 (and perhaps onwards), in a soft scope, we can directly use variable that is created in global scope and change its value without even yielding any warning? This change seems to me would cause more room for ambiguity.