I’m trying to write what I thought should be a simple loop over local variables names inside a function for debugging purposes. The pattern is very simple:
function myfunction(args...; kwargs...) x, y, z = other_function(args...) for var in (:x, :y, :z) println("size($(string(var))) = ", size(eval(var))) end end
for loop fails with an error message saying that
x isn’t defined. I presume that’s because
eval looks in the global scope. How can I make it look in the local scope? It feels like I should place an
@eval somewhere but I tried before
for, and before
function without success. Sorry if the answer is in the metaprogramming section of the manual; that section is quite opaque for me.