4 ms·
> This is code replacement using preprocessor macros and the stringize operator to create homogenous containers. Well, C++ templates are technically done by ma
by pkolaczk 13y ago
> This is code replacement using preprocessor macros and the stringize operator to create homogenous containers.
Well, C++ templates are technically done by macro substitution, too, just they happen in a different stage of the compiler toolchain.
> And a generic/template instantiation phase has been added to the toolchain after the preprocess stage but before the type checking phase.
No, real generics are a part of the type-system; they should be part of the type-checking, not a magic preprocessing step. Therefore the compiler can do many cool things like imposing generic type constraints and also it can improve error messages a lot.
So actually this solution is much, much closer to C++ templates, than to Java/Haskell/Scala/C# generics.