Consider the following nim source:
    
    
    import macros, os, strutils
    
    macro dumbMacro(debug = false): typed =
      let
        debug = if debug.boolVal: "stderr.writeLine \"DEBUG ON\"" else: ""
      parseStmt("""
    echo "Hello from dumbMacro!"
    {debug}
        """.replace("{debug}", debug)
      )
    
    proc main() =
      let debug = "-d" in commandLineParams()
      dumbMacro debug
    
    when isMainModule:
      main()
    

I expect it to say `DEBUG ON` when I supply `-d` as a command line arguments, 
but it doesn't. How can I make it do so? Also, on a side note, is there a way 
to force inline a procedure? The macro I'm messing with is the body of a loop 
that gets executed many times; while I can make it a simple procedure, the 
performance goes down considerably.

Reply via email to