@kcvinu

That's an interesting approach, but it's very atypical and generally not the 
right way to write macros.

Please, don't try to build a string with the nim source that you want in the 
end: usually you iterate, transform and produce the abstract syntax tree: 
NimNode objects. That's exactly where quote comes in
    
    
    let node = quote:
      # some nim code
      # you can add existing nodes here with `existingNode`
      `y`.`z` = `other`
    
    
    Run

This is the first way to build a NimNode: by using something similar to 
templates(have you used templates)?

The second way is manually: 
    
    
    nnkStmtList.newTree(
      nnkAsng.newTree(
        ..
      ))
    
    
    Run

Usually you'd want to use quote, but sometimes it's not possible to build a 
node with it, so then you use the manual way. 

Reply via email to