News for hackers. Stuff that matters.
Re:Why Go Is Not Good (2014) by habitue on Wednesday December 09, 2015 @12:52PM (#10705329)
The way Haskell and rust solve this is that they constrain the types of the overload. If you want to overload +, you implement the Add trait, which has to be a certain type. The Add trait is googleable, and it provides a hint as to how the operator is to be used. In practice Rust and Haskell have much less of a problem than C++ in this respect. Additionally, having a strong culture helps (which Go obviously does). Python has no restrictions on overloading, but it's much less abused than in C++ because there's a cultural aversion to making operators do crazy stuff

There are no comments on this comment yet.