Let's get the semantic around closure fixed.

deadalnix deadalnix at gmail.com
Tue May 18 19:37:14 UTC 2021


On Tuesday, 18 May 2021 at 17:53:20 UTC, Ola Fosheim Grostad 
wrote:
> On Tuesday, 18 May 2021 at 17:40:17 UTC, Max Haughton wrote:
>> On Tuesday, 18 May 2021 at 16:47:03 UTC, deadalnix wrote:
>>> Long story short: 
>>> https://issues.dlang.org/show_bug.cgi?id=21929
>>>
>>> Closure do not respect scope the way they should. Let's fix 
>>> it.
>>
>> Time to consider by-value captures? Closures (specifically the 
>> way they interact with the GC) seem problematic in general, 
>> not just here.
>
> Does a delegate do anything more than retaining a pointer to 
> the stack record?
> Anyway, it should not escape the scope it references. So escape 
> analysis is your friend.

Yes, they allocate the closure on head.


More information about the Digitalmars-d mailing list