That's awesome! Played around with it, and it can be as simple as this:
<https://play.nim-lang.org/#ix=3ZjH> import std / [macros, genasts] macro immut(n: typed) = result = genAst(name = ident(n.repr), n): let name = n proc doThing(i: var int) = immut i i = i + 1 echo i+i var a = 100 doThing(a) Run
