I'm trying to create a set of variables (_1, _2, ...) from items within a 
list in a macro. I have a (much) condensed version of the code:

macro testfn()
    quote
        i = 1
        value = [1, 2, 3]
        $(Expr(:(=), Expr(:symbol, Expr(:string, "_", :i)), :value))
        println(_1)
    end
end


which gives me:

ERROR: syntax: invalid assignment location


Any ideas on what might be wrong or the proper way to do this? I would like 
to keep this in the quotes, as in the actual version there's a lot more 
code surrounding the assignment.

I can get things to work with an eval, but I rather avoid the eval, and it 
appears to create a non-local variable.


Thanks!

Reply via email to