Skip to content

Instantly share code, notes, and snippets.

@barcharcraz
Created February 9, 2014 00:22
Show Gist options
  • Save barcharcraz/4543b539411eebdeb841 to your computer and use it in GitHub Desktop.
Save barcharcraz/4543b539411eebdeb841 to your computer and use it in GitHub Desktop.
import typetraits
import macros
type thingone = object
value: int
macro echoType(t: typedesc) : expr =
result = newStrLitNode(t.name & "name")
proc genericone[T]() =
echo echoType(T)
when isMainModule:
genericOne[int]()
@barcharcraz
Copy link
Author

outputs typedescname

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment