Skip to content

Instantly share code, notes, and snippets.

@fowlmouth
Created July 23, 2015 13:20
Show Gist options
  • Save fowlmouth/104bf402de6ebd343b75 to your computer and use it in GitHub Desktop.
Save fowlmouth/104bf402de6ebd343b75 to your computer and use it in GitHub Desktop.
import macros
var ct {.compileTime.} = 0
proc nextID* : int {.compileTime.} =
result = ct
ct += 1
macro decl (n): stmt =
var id = nextID()
result = quote do:
echo `id`
decl int
decl float
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment