You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can you explain better how to handle variable scope with @capture_out?
I tried a small example with the following script:
using Suppressor #import packagelocal y #define local variablefunctionf(x) #define function
y = x^2println(y)
return y
end
log =@capture_out y =f(2) #capture output#print resultsprintln("log: $log")
println("y = $y")
When I run the script from the REPL (i.e., include(script.jl)), I get the following:
log:4
ERROR: LoadError: UndefVarError: y not defined
The text was updated successfully, but these errors were encountered:
I figured out how to work around this: initialize y before calling @capture_out. If I assign it some value, then the output of f(2) does get stored. Maybe mention this in the readme?
I figured out how to work around this: initialize y before calling @capture_out. If I assign it some value, then the output of f(2) does get stored. Maybe mention this in the readme?
I had the same issue and resolved it following your instructions. I created a PR to update the README.md.
Can you explain better how to handle variable scope with
@capture_out
?I tried a small example with the following script:
When I run the script from the REPL (i.e.,
include(script.jl)
), I get the following:The text was updated successfully, but these errors were encountered: