digitalmars.D - Please do not defer the scoped closure
- Frank Benoit (10/10) Mar 21 2008 I am a bit nervous about the full closure does the silent heap
- Craig Black (5/15) Mar 21 2008 Lambdas syntax in C++ '0X will include a provision to specify explicitly...
- bearophile (12/14) Mar 21 2008 I have found it here:
I am a bit nervous about the full closure does the silent heap allocation. It was said, that there will be a possibility to make it work without the allocation by using 'scope'. See: http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D&artnum=62542 I have lots of code using delegate literal in realtime code. I use it as part of flow control. So refactoring (to avoid the delegate litarals) is hard. Please do not defer that much longer. It's like removing an important feature of D1 out of D2.
Mar 21 2008
"Frank Benoit" <keinfarbton googlemail.com> wrote in message news:fs0rvu$8hm$1 digitalmars.com...I am a bit nervous about the full closure does the silent heap allocation. It was said, that there will be a possibility to make it work without the allocation by using 'scope'. See: http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D&artnum=62542 I have lots of code using delegate literal in realtime code. I use it as part of flow control. So refactoring (to avoid the delegate litarals) is hard. Please do not defer that much longer. It's like removing an important feature of D1 out of D2.Lambdas syntax in C++ '0X will include a provision to specify explicitly whether to instantiate stack variables on the heap or not. -Craig
Mar 21 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
Mar 21 2008