I actually have modularized this (and some already made fun of the "smallest 
module in nimble" ;) )

[https://github.com/enthus1ast/nimDbg](https://github.com/enthus1ast/nimDbg)

i think of adding this macro to the module, though:
    
    
    import macros
    macro decho*(elem: untyped) =
      var varname = repr elem
      quote do:
        echo `varname`, " => ", `elem`
    
    
    Run

which is a huge time safer:
    
    
    decho(1 + 2 - 4)
    # 1 + 2 - 4 => -1
    
    var foo = "asf"
    decho(foo)
    # foo => asf
    
    
    Run

Reply via email to