by SloopJon · 5y ago · 0 comments
"Even"? I actually miss the macro-like power of templates when I'm using generics in Java and C#, but generating the longest possible error message using templates is practically an Olympic sport. I presume that SFINAE is partially to blame, because a lot of the output enumerates all the candidates that didn't match.
[1]https://mobile.twitter.com/WalterBright/status/1343128003178...
[2]https://dlang.org/blog/2018/03/29/std-variant-is-everything-...
To me it's pretty interesting how the three big static OO languages have implemented generics: super flexible permissive macros in C++ (with murderous error messages), type erasure in Java (gross) and actual generics in the runtime (C#). For everyday usage it doesn't matter much but I always like thinking about what's going on under the hood.
Haskell is arguably great with types, and it does type erasure as well.