The Register® — Biting the hand that feeds IT

Comments on: C++ Futures: Lambda Functions

Unreadable syntax 

Posted Friday 22nd September 2006 08:10 GMT

While lambdas are undoubtably a boon to C++ (or any other language that don't already have them), I find the syntax to be unreadable. This may be because I find C++ syntax in general to be horrible, but for comparison you should look at languages like Haskell or SML. I'm not saying that the syntax of these langauges can not be improved, but they are a damn sight more readable than C++ -- lambdas or no lambdas.

You're not hired 

Posted Friday 22nd September 2006 10:53 GMT

Your first example:

void KillByVal(const int x , std::vector<int> & Vec) {

std::remove_if(v.begin(), v.end(), bool (int& n) { n == x; }

};

The remove_if is missing the closing ')'.

Function definitions should not have a ';' after the closing '}'.

Boost Phoenix? 

Posted Tuesday 26th September 2006 14:31 GMT

Have you seen Boost.Spirit's Phonix lambda interface?

http://spirit.sourceforge.net/distrib/spirit_1_7_0/libs/spirit/phoenix/index.html

That enables you to do pretty much what you want to do with the futures or lambda given the current C++ implementation.

Don’t Miss

Vulture logo with head phonesWhy Google Wave makes Tim Bray nervous

Radio Reg XML co-author on complexity and the web

Microsoft .NET logoMicrosoft kills Visual Studio's Oracle data connection

Swift reaction: 'Sucks', 'shortsighted'

Opera Software reinvents complete irrelevance

Fail and You Unites browser with self-delusion

Microsoft's Bing feeds you, tries to keep you captive

Review Fully featured Google inertia beater?