Earlier quoted context omitted.
> if you have a bunch of functions that do fundamentally the same thing with different types That's where you should use parametric polymorphism, that's my point. C++ 23 defines _3_ overloads of string.contains() with parameter defined as variously a char, a char * and a string view, enabling name.contains("Jim") name.contains("Steve"sv) and name.contains('Q'). But if you need a fourth, too bad. Rust doesn't have ove…
Just to be precise, traits and overloading are a form ad-hoc polymorphism not parametric.
In C++ I need to overload doop() exactly three times, once for each of the three types we identified. I can't do it any other way, that's how it must be defined.
But in Rust I just write it once, in terms of Pattern, I don't need to understand how Pattern is actually implemented, that's opaque to me, I just use this Pattern trait and it all works.