The future of lambda delegates

Walter Bright newshound at digitalmars.com
Wed Aug 16 18:43:28 PDT 2006


kris wrote:
> C# gets around all this by (it's claimed) *always* using a heap-based 
> frame for delegates.

That's the copout solution. I find more and more nifty uses for 
(synchronous) delegates, and having to allocate the frames on the heap 
is too high a price to pay. Paying that price would preclude D from 
having a viable alternative to C++ expression templates, for example.

Static escape analysis can yield 3 results:

1) guaranteed to not escape
2) might escape
3) does escape

If most of the (1) cases in actual use can be reliably detected as (1), 
then a reasonable strategy is to do so and allocate on the stack only 
those proven as (1).



More information about the Digitalmars-d mailing list