Howto not Full closure?

Kris foo at bar.com
Tue Nov 27 20:19:00 PST 2007


"Michel Fortin" <michel.fortin at michelf.com> wrote in message 
news:fiinll$1ju8$1 at digitalmars.com...
> On 2007-11-27 13:59:25 -0500, Frank Benoit <keinfarbton at 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.


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 
things a chunk of generic code can do. It's the#1 underlying cause for why 
many people feel Java is slow :p 





More information about the Digitalmars-d mailing list