
Simple C++11 metaprogramming - VeXocide
http://pdimov.com/cpp2/simple_cxx11_metaprogramming.html
======
jlarocco
This type of C++ code makes me sad. I can follow along and figure out what
it's doing, but I really have to slow down and think about it. C++ template
metaprogramming has the ugliest syntax of a "real" programming language that
I've ever seen. Brainfuck might win for hardest to follow code, but god damn
it, C++ is really trying.

IMO, Lisp did metaprogramming the right way, 40 years ago. It's built into the
language and doesn't look like a hacked on cluster f __*. Anybody familiar
with regular Lisp can follow along with Lisp metaprogramming, and it 's far
more powerful than what's available in C++. And nowadays, the performance is
even competitive.

~~~
platform
How did Lisp solve (40 years ago) the problem of generating a compile time
errors when types of the arguments into a function call did not match with
what the developer of the function anticipated?

~~~
vadiml
When you look at error messages of C++ inside of metaprogramming code you
understand that the error reporting in case of argument mismatch is still not
solved .... :)

------
zvrba
Cool post. I have always disliked C++ MP because I couldn't see the forest for
the trees. Judging by the first few examples (using, mp_rename) C++11 cleans
it up and makes it understandable.

------
ndesaulniers
While I know nothing about metaprogramming in C++, the book Metaprogramming
Ruby is one of the most well done and thought provoking programming book I
have ever read, one I always recommend. Really, even if you hate Ruby, it's
worth your while to see how metaprogramming can be used to problem solve,
which is ultimately what all this is about.

The most popular Ruby framework, Ruby on Rails, has quite the learning curve
because it's based heavily on conventions enabled by metaprogramming. inb4
lengthy discussion of "convention vs configuration" and "magic."

------
jokoon
The title seems ironic. Templates are often the part of C++ where I feel like
I'm a complete idiot. It's not exactly the C++ I like, but I like C++ anyway.

------
arithma
On a little less serious note, I hope Haskell and C++ merge into something
beautiful. Peak performance (par aliasing) and peak expressivity/safety.

