Let's get the semantic around closure fixed.
Steven Schveighoffer
schveiguy at gmail.com
Wed May 19 20:34:14 UTC 2021
On 5/19/21 4:20 PM, deadalnix wrote:
> 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.
>>
>
> 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.
Sorry, I misread that, it looked like you were saying in all cases it
could stay on the stack (you did mean to write stack, right?), but
missed the qualifier "if the closure doesn't escape".
-Steve
More information about the Digitalmars-d
mailing list