Hi bieblsoft,
I don't know the roadmap nor the big plan of the standard commity. Maybe they have some real answer to you.
To me, a lambda is an important semantic element and C++ didn't have that element until now.
Readibility doesn't really mean "easy to read" (we know that now with C++) nor does it mean "simple to read".
But lambda emphazises something important to me : put the definition of the thing needed the very next to where it is needed.
For example, this is horrible like aaaaaaaaaaaaahhhhhhhhhhhhhhh /o\ :
1 2 3 4 5 6 7 8 9 10 11
|
void f()
{
int const pi = 3;
std::string const pikachu = "goku";
// and some zillion definitions like that
...
// then here, use pi
... // a billion line afterwards
// use pikachu variable
// etc.
}
| |
It's so much better, even if that doesn't change anything at all, to have :
1 2 3 4 5 6 7 8 9 10
|
void f()
{
// a million line of code here
int const pi = 3;
// use pi now
// a billion line of code
std::string const pikachu = "goku";
// use pikachu here...
etc.
}
| |
Lambda are the same... you define your very function where you need it.
But you've got a good point... there is no real reason why we needed lambdas in C++.
But having a kind of "function object", not only a pointer to a function, is a real advance concept. It's just like reference and pointers... what the hell ?
Well, in turns out that with that little bit of semantic (the reference), you can then create the definition of operator ^_^. Only with pointers, this is not possible because of the semantic the pointers have with the additionnal "*" and "&".
And finally, with lambdas, we enter the realm of lambda calculus... to violate the rules right from the beginning, ok, but we now have a step in it \o/