3 ms·
> Sure, because they're not type safe. Templates simply aren't a type system extension, they're more like macros. Could you elaborate in which way C++ template
by MauranKilom 5y ago
> Sure, because they're not type safe. Templates simply aren't a type system extension, they're more like macros.
Could you elaborate in which way C++ templates are not type-safe? Does the upcoming concepts feature alleviate any of it?
- choeger 5y agoA type safe language has a deterministic, terminating algorithm that can prove the absence of certain errors in a program. For instance you cannot use integers instead of functions in well-typed a Haskell program whereas you can make this mistake in a python program. C++ Templates are not type safe because they need to be evaluated before you can make any statement about their successful, correct application. This evaluation might not terminate. Macros habe the same issue, of course, but they explicitly give you a Turing-complete programming language so it feels more natural.