This thread is a very disheartening read for someone trying to use Julia’s powerful libraries for quick experimentation with a new idea. I can’t fathom why Julia needs to enforce scope to “coach [us] to better programming practice”. Who cares if my code is slow, besides me? I just want to try running a for loop. For what it’s worth I am trying to debug something like the below and getting scope errors out the kazoo:
nIter = 10
numReals = zeros()
p_star = zeros(27)
currNumReals = 0
for i = 1:nIter
new_model = MvNormal(p_star,I)
param_star = rand(new_model,1)
...
a = solve(F)
tempNumReals = length(real_solutions(a))
if tempNumReals > currNumReals
p_star = vec(param_star)
currNumReals = tempNumReals
else
p_star = p_star
currNumReals = currNumReals
end
numReals[i] = currNumReals
end