Hi everyone, I'm working on a custom DSL in Nim for generating HTML, and I'm trying to figure out the best way to pass props to components. Here’s a simplified version of my current setup: import htmlElements template html*(name: untyped, children: untyped) = proc `name`*(): string = result = "<html>" children result.add("</html>") template component*[T](name: untyped, children: untyped) = template `name`*(props: T) = `children` type MyProp = object text: string component[MyProp](MyComponent): h1: props.text html app: body: MyComponent(MyProp(text:"HELLO WORLD")) echo app() Run
The above gives me `Error: undeclared identifier: 'props'` in the console. What is the best way to pass props to components in this DSL? Are there standard practices or patterns in Nim for achieving this effectively? Any advice or examples would be greatly appreciated! Thank you!