I don't mind C++'s lambdas, but in some other languages they use "arrows", like
square = (x) -> x * x
C++ won't want to give up the different kinds of capturing, though, so it's hard to see anything much better than what's available now.In imaginary, never-to-be-implemented language daydreams I toy with the idea of using curly braces and implicit positional arguments to have lambdas look like
square = { _1 * _1 }
and factorial = { (_1 < 2) ? 1 : _0(_1 - 1) }
and with explicit captures and arguments, partial_sort = [<_vec, &ge_vec, pivot](item){
if (item < pivot) lt_vec.add(item)
else ge_vec.add(item)
}
I suspect, though, those ideas are just horrible shortcuts to a Perl-like hell :-)