January 17, 2013

Concurrency in C++11

Today, I've watch two talks on concurrency. I wasn't specifically look for that topic, they just happened to pop up in my google reader list. One of them was from the Go programming language blog, the other from Herb Sutter's blog on C++11. Herb is an amazing lecturer but unfortunately for him, I watch his second.

I don't know Go (and don't particularly like its syntax) and I do know some C++ (and I've watched a few videos and read a few articles on C++11 already), but even I can see a qualitative jump when understanding a simple concurrent algorightm in a language that was thought from the ground-up with those concepts in mind. Think of the classic discussion where a C programmer argues how you can do anything that C++ does in C, and the C++ programmer replies that you can do anything that C does in assembly, but that's not the point, the point is simplicity. Richness of expression in simple terms means less code. Less code to write, less code to read, less code to maintain. Less code is good. Sure, I still see the point on being able to tune every tiny detail to squeeze the last bit of performance, but could it have been done in a more clear syntax? Stroustrup said that C++11 feels like a new language and language advocates quote him with proud. But to me it sounds backwards.  If you are writing a new language, write a new language. The new syntax is compatible with older C++ in order to keep millions of existing C++ programmers in the boat. But these programmers will not use C++11 in a new way because it feels like a new language, and if all those features (like lambdas) are really the way to go and they want to try a new language that offers them, they would just learn one that doesn't require training your brain not to melt when looking at all those [[=&]].

Anyway, these are just a few thoughts. I'm actually quite curious about C++11 and I'm looking forward to experiment a bit with it.

I need to think a bit more about this, and should consider if leng should have concurrency built-in..

No comments:

Post a Comment