Hey guys, I've been implementing an AST data structure in Nim following the model of the NimNode structure, but something bothers me with this approach while implementing it: when using an object with enum-discriminated variants like NimNode does you can't restrict a node's type to one of its variants like it would naturally be the case if using inheritance, which means that you have to put assertions in every function that expects a variant which also feels less readable and doesn't tell the user what the input should be unless he either runs the function once with an invalid argument or look at the source code, which also makes parameter naming more difficult and verbose because you're only left with naming to indicate what it should be to the user, and this has limits, you cant express more than one or two expected kinds just by the naming alone, so I also tried using inheritance instead but by looking at the type definitions it feels less clean and readable than the first approach, and since I want the users of my library to quickly understand how to use it if they're already familiar with nim's metaprogramming I decided to use the variant approach, I also thought of using templates to force the user to narrow his node kind before calling the function, otherwise creating a compile-time error but the problem with this is that it doesn't solve the prototyping issue because the error happens inside the template's body, and I want it to happen directly when you call the template, but by knowing the capabilities of this language I could bet there's a macro trick we can do to achieve this, did someone manage to pull it off already ?