News for hackers. Stuff that matters.
Re:Church Numerals in C++ (and Haskell) by tomjen3 on Saturday April 24, 2010 @06:01PM (#1291637)
Templates are useful when you need to use the standard containers.

When you start doing metaprogramming beyound that, guys like me start to get very nervous.

Re:Church Numerals in C++ (and Haskell) by hazzen on Saturday April 24, 2010 @07:08PM (#1291736)
I like to make a very important distinction with templates in C++, categorizing uses into three classes:

1) "Java" generics. That is, anything you could do with generics in Java. No one should have an issue using templates like this.

2) Non-recursive "typedef" programming. That is, uses like "::value_type" in the STL containers. These are incredibly useful to have around when writing generic algorithms, but their overuse leads to unparseable code to some set of C++ programmers. Use with caution, but still use.

3) Recursive templates and other subtle uses I haven't covered with the above two. Try very, very, very hard to avoid.

That makes the "will my coworkers understand this code?" question very easy to answer.

Re:Church Numerals in C++ (and Haskell) by keveman on Saturday April 24, 2010 @10:08PM (#1291992)
Where would you place expression templates that help designers to embed simple domain specific languages in C++? The end user doesn't have to know much about templates, but this approach leads to high performance AND very concise and expressive code.
Re:Church Numerals in C++ (and Haskell) by dons on Saturday April 24, 2010 @09:54PM (#1291970)
4) Implementing Turing-complete type level languages

:-)