How to Pass Props to Components in a Custom Nim DSL?

2024-07-25 Thread bmanivelle
Templates are hygienic by default, so `props` is unknown to `children`, see I changed a few things to make your example compile without importing `htmlElements`, most importantly note the `props {.inject.}`:

how to get pragma of the field in macro?

2024-01-04 Thread bmanivelle
You can use `getTypeInst` combined with `getImpl` to get the type's AST including pragmas on its fields, that's how `hasCustomPragma` does it (but as a macro it can't be used from inside a macro AFAIK), see `customPragmaNode` in

concepts and openArray

2023-09-20 Thread bmanivelle
You can remove the recursive part by re-using the type being matched by the concept. type Stream[T] {.explain.} = concept s, t, type S s[Natural] is T # can index s[Natural..Natural] is S # can slice for i in s: # can iterate i is T s.l

Type class that is "anything but X"

2023-08-10 Thread bmanivelle
This works without concepts type X = object Y = object Z = object NotXY = not (X | Y) proc doSomething(_: NotXY) = discard let x = X() y = Y() z = Z() echo compiles(x.doSomething) # false echo compiles(y.d