Files
Nim/tests/template/mgensym_generic_cross_module.nim
2018-08-13 13:02:52 +02:00

15 lines
308 B
Nim

template makeDomElement(x: untyped, name: string = "") =
const tag {.gensym.} = if name.len == 0: astToStr(x) else: name
proc x*(p: int|float) =
echo tag, p
proc x*(p: string|cstring) =
echo tag, p
#proc wrappedUp[T](x: T) =
# mixin foo, bar
makeDomElement(foo, "foo")
makeDomElement(bar)