You probably want eval(:(const $(Symbol(key)) = $(parsed_args[key]))). (Note that I’m inserting the value of parsed_args[key] directly into the expression tree.) In general, it is vastly more flexible and reliable to build expression trees directly rather than parsing strings.
2 Likes