Is it possible to pass 3 or more parameters to a pragma or block type macro? 
For example, say I want to pass an int and string to a pragma macro. The 
example below generates the error:

t.nim(10, 34) Error: identifier expected, but found '42'
    
    
    import macros
    
    macro echoName(value: static[int], ending: static[string], x: untyped): 
untyped =
      # echo "x = ", treeRepr(x)
      let node = nnkCommand.newTree(newIdentNode(!"echo"),
                   newLit($name(x) & $value & ending))
      insert(body(x), 0, node)
      result = x
    
    proc add(p: int): int {.echoName 42, "p1".} =
      result = p + 1
    
    proc process(p: int) {.echoName 43, "p2".} =
      echo "ans for ", p, " is ", add(p)
    
    process(5)
    process(8)
    

Reply via email to