Hacker News new | ask | show | jobs
by ernst_klim 2488 days ago
Which can be done, since OCaml has objects

    let (+) a b = a#add b
1 comments

Yeah, I guess you can get a limited sort of operator overloading by building it out of row polymorphism. That doesn't solve the most common use-case of operator overloading, though, which is allowing the same operators to work on floats and ints, because it only works on objects.