These practices helped me, don't know whether they are "best" :-)

**Keep it obvious** : inner templates are probably more readable than 
constructing and assembling AST nodes "by hand": 
    
    
    macro m(...): untyped =
      template tpl(...) =
        # people see what is built here
      
      # other logic
      
      result = getAst(tpl(...))
    
    
    Run

**Prefer procs to sub-macros where possible** : in case a piece of meta-code 
should be reuseable, a `proc` accepting `NimNode` arguments can do most things 
a `macro` can, plus it

  * should be more compile-time efficient
  * behaves less surprisingly to novice programmers 


Reply via email to