Please do not defer the scoped closure
bearophile
bearophileHUGS at lycos.com
Fri Mar 21 12:44:11 PDT 2008
Craig Black:
> Lambdas syntax in C++ '0X will include a provision to specify explicitly
> whether to instantiate stack variables on the heap or not.
I have found it here:
http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions
The syntax for simple expressions is shorter than D one:
<>(int x, int y) (x + y)
In D:
(int x, int y) { return x + y; }
But reading that Wikipedia page the semantics is really too much complex! Those C++0x designers seem mad, they think that the mind of programmers has no bounds. I like languages that leave a bit of free space in my mind, because I have other things too to think about, and other languages to know.
For D the default can be the safer one (on the heap), with something optional to use the stack instead.
(I haven't used the D 2.x yet, but I'd like to write a tiny monad-based parser with its closures).
Bye,
bearophile
More information about the Digitalmars-d
mailing list