You can use the `{.error.}` pragma with `when` to cause a compilation error, 
you can also give a message
    
    
    template `==`(a: Real, b: typed): bool =
      when typeof(b) is not float:
        {.error: "Reals can only be compared to floats".}
      a.val == b
    
    
    Run

Reply via email to