Let's get the semantic around closure fixed.

deadalnix deadalnix at gmail.com
Wed May 19 20:20:50 UTC 2021


On Wednesday, 19 May 2021 at 19:48:05 UTC, Steven Schveighoffer 
wrote:
> On 5/19/21 3:05 PM, deadalnix wrote:
>> On Wednesday, 19 May 2021 at 18:43:24 UTC, Steven 
>> Schveighoffer wrote:
>>> You mean opApply? Not necessarily, if the delegate parameter 
>>> is scope (and it should be).
>>>
>> 
>> In all cases, if the closure doesn't escape, it can stay on 
>> heap. This is what compiler optimization do.
>> 
>
> This results in code that only compiles when optimized.
>
> -Steve

No that result in code that looks like it's always allocating on 
the heap, but in fact doesn't if it doesn't need to.


More information about the Digitalmars-d mailing list