Other option, with compile time errors: import macros template final_sort2(v: bool): int = 3 macro final_sort2(v: typed): int = error("Incompatible type: " & repr(getTypeInst(v)), v) echo final_sort2(true) echo final_sort2("hi") # Error: Incompatible type: string Run
- How to raise an exception from a template? spip
- Re: How to raise an exception from a template? spip
- Re: How to raise an exception from a template? jyapayne
- Re: How to raise an exception from a template? Hlaaftana