I generate two AST's using two different templates. Replacing one node of the 
fist tree with the whole second tree woks fine. How can I define a variable in 
the first template and use it in the second?
    
    
    template first(): untiped =
      var n = 1
      echo "this very line gets replaced with code from another template"
    
    template second(): untiped =
      n = 2 # <-- undefined
    
    
    Run

Working with macros without using templates is an exhausting affair. A couple 
lines of code produces a giant tree.

I can't use one single template because I can't iterate over passed arguments. 
So I've come up with such a solution: to generate tees separately and then 
merge them into one. 

Reply via email to