Rust may be a different story (still too soon to tell) because it shares many of the fundamental philosophies of modern C++ without having a "bolted-on" feel. Still, it will be very hard to ever displace C++, because so much code is currently written in C++ and C++ has proven to be a very good language for code that needs to last decades.
This is one of my big frustrations with Go. I see lots of ugly `interface` based patterns.
I wish more languages would adopt Haskell's typing system (at least partially). It is truly beautiful.
I'm pretty sure that Rust devs are aware of that which is why they made Rust compatible with C/C++.
For a small example, a friend talked me into implementing a few Scala collection operations in C++11. Here's the result: https://gist.github.com/LnxPrgr3/6547131
Usage looks like this:
const collection<vector<string>> names = {"Daniel", "Chris", "Joseph"};
return names.reduce_left<string>([](const string &total, const string &value) {
return total + ", " + value;
}) == "Daniel, Chris, Joseph";
// ...
const collection<vector<string>> strs = {"1", "2", "3", "4", "5"};
auto rv = strs.map<collection<vector<int>>>([](const string &x) {
return atoi(x.c_str());
});
return rv.size() == 5 && rv[0] == 1 && rv[1] == 2 && rv[2] == 3 && rv[3] == 4 && rv[4] == 5;
This is from a collection of tests, which looks like this: struct test {
const char *name;
function<bool ()> fn;
};
const vector<test> tests = {
{"Foldleft", []{ /* .... */}},
{"reduceLeft on empty throws", []{ /* ... */ }},
// ...
};
for(auto &test: tests) {
cout << test.name << ": " << flush << (test.fn() ? "PASS" : "FAIL") << endl;
}
I would've never considered something like this useful in C++03—callers would have to create named functor classes just to do some trivial one-line operation, this vector of tests would've had to have been a series of push_back calls, and iterating over it would've been quite a bit uglier.This isn't at all an exhaustive list, but these are the biggest things that come to mind when I think of what C++11 gains over C++03.
In benchmarks Go keeps performing somewhere between Java and C++, but it isn't at the baremetal performance of C / C++ yet. Don't know if it can get there with its abstractions. Rust is closer, but it concedes a lot of glyphic syntax (such as requiring :: for scope like in C++ rather than, say, one colon) but I don't see it hitting prime time until Mozilla is ready for Servo to enter Firefox. It needs a big project behind it to show its capable.