Scala’s Macros and C++ templates both provide access to compile time meta-programming. Could you elaborate on similarities and differences? Are they equal in terms of expressiveness?
Scala’s Macros and C++ templates both provide access to compile time meta-programming. Could you
Share
One important difference between them is that Scala macros are written in Scala, whereas C++ templates are their own programming language, which is completely unlike C++. C++ is an imperative object-oriented strict impure language, C++ templates are a declarative hybrid logic/functional non-strict pure language, which was never intended to be used as a full-fledged programming language, and thus lacks many of the features necessary for programming in the large.