2 ms·
That was the goal of the C++ STL. Some may argue it goes too far, other opinions suggest it doesn't go too far enough; however I think most people can agree tha
by seabee 12y ago
That was the goal of the C++ STL. Some may argue it goes too far, other opinions suggest it doesn't go too far enough; however I think most people can agree that you need typeclasses/traits/concepts et al. if you don't want to be doomed to passing different data structure manipulation functions to every call, as in your replacement example, or else resort to underspecifying the requirements of your type parameters and experiencing compiler messages from Hell.
- cousin_it 12y agoI'm hoping that some system like Scala's implicit arguments or Agda's instance arguments could ease the burden of passing stuff around. I don't know if that's enough for most realistic use cases, though. There's another complication. For operations that make sense on only some types, it makes sense to pass around the implementation of the operations, because it also acts as a type constraint. But for operations that make sense on all types, like Java's equals/hashCode/toString (and possibly also comparison), I suppose it's better to make them overridable for each type, as a special case in the language.