The bigger problem than Meta.parse
is eval
:
Julia’s eval
only works at global scope. If you do something like eval(parse("y = [1,2,3]"))
, it’ll create a global y
that’s separate from any local y
s you might have inside your function. At best, it’ll be very slow and fragile.
Especially if you’re parsing user input.
julia> eval(Meta.parse("[1,2,3,run(`echo 'rm -rf /'`)]"));
rm -rf /
Oops.