mgensym_generic_cross_module.nim 308 B

123456789101112131415
  1. template makeDomElement(x: untyped, name: string = "") =
  2. const tag {.gensym.} = if name.len == 0: astToStr(x) else: name
  3. proc x*(p: int|float) =
  4. echo tag, p
  5. proc x*(p: string|cstring) =
  6. echo tag, p
  7. #proc wrappedUp[T](x: T) =
  8. # mixin foo, bar
  9. makeDomElement(foo, "foo")
  10. makeDomElement(bar)