Quantcast
Channel: Dan Weinreb's blog » Lisp
Viewing all articles
Browse latest Browse all 10

C++ Template Metaprogramming

$
0
0

I have not used C++ in many years. It was so long ago that templates, in the way they are used today, were not in C++ yet. I hope I never have to program in C++ again. That said, it’s interesting to know that C++ templates are so powerful that you can write a compile-time Lisp interpreter in them!

The following is from the notes at Amazon about the book “C++ Template Metaprogramming” by David Abrahams and Alexey Gurtovoy:

“In 1998 Dave had the privilege of attending a workshop in Generic Programming at Dagstuhl Castle in Germany. Near the end of the workshop, a very enthusiastic Kristof Czarnecki and Ullrich Eisenecker (of Generative Programming fame) passed out a few pages of C++ source code that they billed as a complete Lisp implementation built out of C++ templates. At the time it appeared to Dave to be nothing more than a curiosity, a charming but impractical hijacking of the template system to prove that you can write programs that execute at compile time. He never suspected that one day he would see a role for metaprogramming in most of his day-to-day programming jobs.”

Thanks for David Mankins for bringing this to my attention!

I recently learned about Python’s powerful metaprogramming techniques, from a talk by Adam Baratz of The Echonest. This was very impressive and I hope to find time to learn more.


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images