I am using ArgParse.jl
to parse command line arguments. It returns a dictionary. But I would prefer to generate variables so it’s easier to use them. I tried to use Meta programming as follows
function main()
parsed_args = parse_commandline()
# Turn the dictionary into variables
for key in keys(parsed_args)
ex = Meta.parse("const $key = parsed_args[\"$key\"]")
eval(ex)
end
do_something(n1, n2, d1, d2)
end
But I got
ERROR: LoadError: UndefVarError: parsed_args not defined
What did I do wrong?