The future of lambda delegates

kris foo at bar.com
Wed Aug 16 19:49:03 PDT 2006


Walter Bright wrote:
> kris wrote:
> 
>>> 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?
> 
> 
> If the source to that function is not known to the compiler, then yes.

Aye; that's a tough one.

On the one hand it's certainly 'safer' to rely on analysis only. On the 
other, there's a lot of good reason to support a means to disable the 
analysis (for known cases) thus ensuring a stack-frame instead. The 
latter could be fraught with issue, though; just like the former.

I'm hoping there's another option, better than both the above (or the 
above combination) ~ it's seems apparent that neither present an ideal 
resolution



More information about the Digitalmars-d mailing list