Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SoftScope in Infiltrator REPL #125

Open
pdeffebach opened this issue Sep 19, 2024 · 0 comments
Open

SoftScope in Infiltrator REPL #125

pdeffebach opened this issue Sep 19, 2024 · 0 comments

Comments

@pdeffebach
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant