News for hackers. Stuff that matters.
Re:Nim Programming Language v0.15.0 released by dom96 on Saturday October 01, 2016 @07:23AM (#12617410)
You can also do this (in case that's any clearer):

    template debugImpl(varName, value: typed) =
      stdout.write(varName)
      stdout.write(": ")
      stdout.writeLine(x)

    macro debug(n: varargs[expr]): stmt =
      result = newNimNode(nnkStmtList, n)
      for x in n:
        result.add(getAst(debugImpl(toStrLit(x), x)))
Whether the Lisp version is clearer or not is very subjective, and you obviously have a lot more experience with it so of course it's clearer for you. To me, the Nim version is far clearer.

Edit: flyx's version is even better!

Re:Nim Programming Language v0.15.0 released by qwertyuiop924 on Saturday October 01, 2016 @07:56AM (#12617493)
I am aware that a template would work in this case (it would also do so in Scheme, but templates are generally less powerful, and I was making a point about imperative macro systems). And yeah, that mixture of templates and macros that you used is semantically similar to what my Scheme code did. But I find Nim discourages writing small templates, which I find myself doing a lot when writing macros in Scheme. Personally, I find that Nim less confusing but still quite awkward.