My Blog

My WordPress Blog

Tag: Operator Overloading


  • So. SML lets you redefine basic operators on basic types

    For instance, I could do this- fun op-(x,y) = x+y This makes the ‘-’ operator do integer addition.  Reals?  Hah, no subtracting them now!  Fails type checking on anything but ints. I can also do: fun op-(x) = ~x; Now, the ‘-’ operator does nothing except spawn error messages wherever it is used.  Well, wherever…