Skip to content

Instantly share code, notes, and snippets.

@flaviut
Created March 8, 2014 03:40
Show Gist options
  • Save flaviut/76225c559b0c80210df2 to your computer and use it in GitHub Desktop.
Save flaviut/76225c559b0c80210df2 to your computer and use it in GitHub Desktop.
test.nim(2, 9) Error: undeclared identifier: 'T'
================================================
template foo[T](a: T, body: stmt): stmt {.immediate.} =
var b: T
body
foo("a"):
discard "" # Anything else too
Compiles
=======
template foo(T: typedesc, a: T, body: stmt): stmt {.immediate.} =
var b: T
body
foo(string, "a"):
discard "" # Anything else too
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment