| Thread overview | |||||
|---|---|---|---|---|---|
|
March 21, 2008 Please do not defer the scoped closure | ||||
|---|---|---|---|---|
| ||||
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. | ||||
March 21, 2008 Re: Please do not defer the scoped closure | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Frank Benoit | "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 | |||
March 21, 2008 Re: Please do not defer the scoped closure | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Craig Black | 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 | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply