News for hackers. Stuff that matters.
Re:Write your own Excel in F# (2018) by dean177 on Sunday August 25, 2019 @08:07PM (#20796523)
This isn’t really true.

You can do: let ( + ) a b = ...

Just fine

Re:Write your own Excel in F# (2018) by thedufer on Sunday August 25, 2019 @11:20PM (#20797224)
That's a custom operator definition. Operator overloading is when the same operator can be used on different types (for example, if `+` worked on both floats and ints, instead of explicitly having to reach for the correct `+` like you do in OCaml).
Re:Write your own Excel in F# (2018) by ernst_klim on Tuesday August 27, 2019 @03:35AM (#20807090)
Which can be done, since OCaml has objects

    let (+) a b = a#add b
Re:Write your own Excel in F# (2018) by thedufer on Tuesday August 27, 2019 @10:23AM (#20809857)
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.