News for hackers. Stuff that matters.
Re:Haskell: OOP vs type classes by dmooney1 on Tuesday December 20, 2011 @05:03PM (#3375385)
I agree - type overloading says templates to me rather than inheritance. C++'s tuple class lets you do some of the cool listy type things you can do in Haskell. Using typedef tuple<double, double> FloatPoint and taking it from there seems a lot more like the Haskell example and would be less code - one line each for the typedefs and a one-line function to implement <<. (Not taking anything away from Haskell, which I'm completely in love with.)
Re:Haskell: OOP vs type classes by kd0amg on Tuesday December 20, 2011 @06:55PM (#3375754)
The typedef tuple strategy doesn't let you distinguish between types except by the types and ordering of their fields. If you later have a constructor for another ADT (or even the same one) which also takes two Float arguments, you end up with multiple typedefs for tuple<double, double>.