-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Even though the documentation says that @eval works inside of user-defined functions, here's an example where it doesn't:
julia> import Pkg; Pkg.activate(temp=true); Pkg.add(name="TidierData", version="0.17.0")
julia> using TidierData
julia> df1 = DataFrame(trainsz=rand([200, 140, 110, 80], 100), loss=rand(100), p=rand([1,2,3], 100));
julia> df2 = DataFrame(trainsz=rand([200, 140, 110, 80], 100), loss=rand(100), p=rand([1,2,3], 100));
julia> function plot_comparison(losses_ARp, what)
for (i, trainsz) in enumerate([200, 140, 110, 80])
df_ARp = @eval @filter(losses_ARp, trainsz == $trainsz)
df_ARp_comp = @eval @filter(what, trainsz == $trainsz)
end
end;
julia> plot_comparison(df1, df2)
ERROR: UndefVarError: `losses_ARp` not defined in `Main`
Suggestion: check for spelling errors or missing imports.
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/TidierData/59JUA/src/TidierData.jl:422 [inlined]
[2] top-level scope
@ REPL[5]:415
[3] eval
@ ./boot.jl:430 [inlined]
[4] plot_comparison(losses_ARp::DataFrame, what::DataFrame)
@ Main ./REPL[5]:3
[5] top-level scope
@ REPL[6]:1Are there any workarounds?
Metadata
Metadata
Assignees
Labels
No labels