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

Reply via email to