Hacker News new | ask | show | jobs
by tman 5846 days ago
Where functional programming in C++ falls apart is this step:

  bind(std::plus<int>(), _1, bind(&Die::faceValue, _2))
When I first learned the STL, I worked pretty hard to figure out bind, etc., and get rid of all my for loops. The problem is that it doesn't actually buy you that much. The for loop is uglier, but simpler to maintain, read, and debug.

Luckily the lambda syntax from the new standard already appears to be available in experimental gcc. This is going to be a game-changer.

1 comments

The lambda stuff is in g++ 4.5, which is a stable release, right? It's not really experimental.
Lambdas are also supported in MSVC++ 2010.
http://gcc.gnu.org/gcc-4.5/cxx0x_status.html : "Status of Experimental C++0x Support in GCC 4.5"

Last month's release of 4.5.0 is stable, but the C++0x support is experimental.