Infiltrator.jl
Infiltrator.jl copied to clipboard
SoftScope in Infiltrator REPL
A pretty big annoyance I have with infiltrator is it's use of global scope rules inside the REPL.
julia> using Infiltrator
julia> function foo()
@infiltrate
x = 1
for i in 1:5
x += 1
end
x
end;
julia> foo()
Infiltrating foo()
at REPL[9]:2
infil> x = 1
for i in 1:5
x += 1
end
┌ Warning: Assignment to `x` in soft scope is ambiguous because a global variable by the same name exists: `x` will be treated as a new local. Disambiguate by using `local x` to suppress this warning or `global x` to assign to the existing global variable.
└ @ none:3
ERROR: UndefVarError: `x` not defined
Stacktrace:
[1] top-level scope
@ ./none:3
Given that we are basically always running code meant to exist inside local scopes, it's a real friction for the code we run to have global scope rules. I have to wrap things in a let block and then I lose access to intermediate information.
I would really like to see the scope changed for the Infiltrator REPL.