The future of lambda delegates
kris
foo at bar.com
Wed Aug 16 19:10:42 PDT 2006
Walter Bright wrote:
> 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.
I wholeheartedly agree :)
>
> 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).
Aye, but doesn't that imply a heap-frame when passing a delegate to
another function, when you explicitly know all callbacks will be
synchronous only?
That would not be good at all, so I hope that wouldn't be the case :(
More information about the Digitalmars-d
mailing list