Howto not Full closure?
Walter Bright
newshound1 at digitalmars.com
Tue Nov 27 20:27:38 PST 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.
More information about the Digitalmars-d
mailing list