On Mon, Nov 2, 2015 at 12:52 PM, Deniz Yuret <[email protected]> wrote: > If I have the following function: > > function foo(k,v) > @eval ($(symbol(k))=$v) > println(bar) > end > > > and I call it with: > > foo("bar", 5) > > then the global variable bar is set to 5 and the function prints 5. > > Is there any way to make @eval set a local variable inside foo instead? (I > tried prefixing the assignment with local which didn't work).
No. You can't construct arbitrary expressions at runtime and hope the compiler to reason about what you constructed. > > thanks, > deniz >
