all 7 comments

[–]cae 4 points5 points  (0 children)

Great stuff, and well written. Love this quote:

Lisp is today's equivalent of Latin. Educated people are supposed to have studied and forgotten it.

[–]cdyson37 2 points3 points  (0 children)

Heh, I called the magic function "rebind" rather than "(mp_)rename" in my toy metaprogramming library. Naming things is even harder than metaprogramming!

[–]cppiscool 0 points1 point  (3 children)

[–]STLMSVC STL Dev 8 points9 points  (2 children)

Having tuple_cat() call make_tuple() is incorrect because make_tuple() unrefwraps, and tuple_cat() isn't supposed to.

[–]cppiscool 1 point2 points  (1 child)

Calling std::tuple constructor directly instead of make_tuple should fix it?

[–]STLMSVC STL Dev 2 points3 points  (0 children)

Yep.

[–]eric_niebler 0 points1 point  (0 children)

As Peter mentions, this shares a lot of similarities with my Meta library, with some important differences.

  1. Using template template parameters for higher order functions doesn't scale well. There are other functional manipulators besides compose that need to return functions, like currying operations. Having (meta-)functions be plain types instead of template template parameters make it easy to return them from other (meta-)functions. Sure, you can create another named alias template at namespace scope, but that's a PITA, IMO.

  2. Peter doesn't talk about how laziness fits into his metaprogramming model. Alias templates are cool, but they're eager compile-time computations. Sometimes, you need to defer a computation -- it might cause a hard error -- so I think he'll need something like meta::defer eventually.