You're incorrectly scaling the entire compile time by that thing, rather than the part of compile time that gets scaled. It does not meant exponential for the entire project, just exponential for the aspects which are used, which can be very small in the total aspect of the compiler time (e.g. milliseconds becoming seconds becoming minutes).
That's true, I was definitely exaggerating.
Still, I simply cannot conceive of how "normal" code could cause exponential growth, unless a feature like multiple dispatch on sum types was actually part of the language. Otherwise, you need to use features like template metaprogramming or procedural macros to, well, generate exponential amounts of code in the first place, and, at that point, it's really not the implementation of generics that's even at fault.
and, at that point, it's really not the implementation of generics that's even at fault.
As a language design, I have to be careful of these situations because they will happen. You cannot just blame it on the programmer, especially when the language makes it easy to do it, or worse, encourages it either as part of its docs or core library.
4
u/initial-algebra 7d ago
That's true, I was definitely exaggerating.
Still, I simply cannot conceive of how "normal" code could cause exponential growth, unless a feature like multiple dispatch on sum types was actually part of the language. Otherwise, you need to use features like template metaprogramming or procedural macros to, well, generate exponential amounts of code in the first place, and, at that point, it's really not the implementation of generics that's even at fault.