digitalmars.D - Howto not Full closure?
- Frank Benoit (12/12) Nov 27 2007 I often use local functions and lambdas. I also often pass their
- Michel Fortin (6/22) Nov 27 2007 Perhaps D needs "scope" inner functions.
- Kris (7/26) Nov 27 2007 Seem reasonable that there should be some way (any kind of way) to tell ...
- Walter Bright (4/17) Nov 27 2007 It's a significant problem. I hope to address it in the future by using
- bearophile (4/7) Nov 28 2007 The closures for Java may give some ideas:
I often use local functions and lambdas. I also often pass their address. And most of the time, i do this in environments, where i don't want use heap allocations. In my cases i know, that the function/method I call will not store the delegate address for later use. It will use it immediately. Is there a way to not heap allocate the stack frame? Is there a language feature missing to tell this to the compiler? For me, those local functions and lambdas are a really valueable and perfomant language feature. With the implied heap allocation this feature dies for me. Not taking the address or not referencing local variable is not an option for me.
Nov 27 2007
On 2007-11-27 13:59:25 -0500, Frank Benoit <keinfarbton googlemail.com> said:I often use local functions and lambdas. I also often pass their address. And most of the time, i do this in environments, where i don't want use heap allocations. In my cases i know, that the function/method I call will not store the delegate address for later use. It will use it immediately. Is there a way to not heap allocate the stack frame? Is there a language feature missing to tell this to the compiler? For me, those local functions and lambdas are a really valueable and perfomant language feature. With the implied heap allocation this feature dies for me. Not taking the address or not referencing local variable is not an option for me.Perhaps D needs "scope" inner functions. -- Michel Fortin michel.fortin michelf.com http://michelf.com/
Nov 27 2007
"Michel Fortin" <michel.fortin michelf.com> wrote in message news:fiinll$1ju8$1 digitalmars.com...On 2007-11-27 13:59:25 -0500, Frank Benoit <keinfarbton googlemail.com> said:Seem reasonable that there should be some way (any kind of way) to tell the compiler "hey, I know what I'm doing here; step away from the heap!". After all, heap allocation (and subsequent GC load) is one of the more expensive many people feel Java is slow :pI often use local functions and lambdas. I also often pass their address. And most of the time, i do this in environments, where i don't want use heap allocations. In my cases i know, that the function/method I call will not store the delegate address for later use. It will use it immediately. Is there a way to not heap allocate the stack frame? Is there a language feature missing to tell this to the compiler? For me, those local functions and lambdas are a really valueable and perfomant language feature. With the implied heap allocation this feature dies for me. Not taking the address or not referencing local variable is not an option for me.Perhaps D needs "scope" inner functions.
Nov 27 2007
Frank Benoit wrote:I often use local functions and lambdas. I also often pass their address. And most of the time, i do this in environments, where i don't want use heap allocations. In my cases i know, that the function/method I call will not store the delegate address for later use. It will use it immediately. Is there a way to not heap allocate the stack frame? Is there a language feature missing to tell this to the compiler? For me, those local functions and lambdas are a really valueable and perfomant language feature. With the implied heap allocation this feature dies for me.It's a significant problem. I hope to address it in the future by using 'scope' to tag function parameters that do not escape, coupled with some interprocedural analysis.
Nov 27 2007
Walter Bright:It's a significant problem. I hope to address it in the future by using 'scope' to tag function parameters that do not escape, coupled with some interprocedural analysis.The closures for Java may give some ideas: http://www.javac.info/ bearophile
Nov 28 2007