Idea for avoiding GC for lambdas
Steven Schveighoffer
schveiguy at gmail.com
Tue Jun 22 14:49:34 UTC 2021
On 6/22/21 1:57 AM, Ola Fosheim Grostad wrote:
> On Monday, 21 June 2021 at 20:01:27 UTC, Steven Schveighoffer wrote:
>> The compiler would see there's a lambda involved, automatically pass
>> the context parameter `someval` into the function itself, and
>> everything magically works. It would only be used when a closure would
>> otherwise be allocated, and the function being called declares the
>> context parameter.
>>
>> Disclaimer: I am not a language developer.
>>
>> Does this make sense? Is there anything feasible that might be
>> similar? Would it be more feasible with different syntax?
>
> You are asking for C++ lambdas? No need for a new type of template
> parameter.
>
I was kinda hoping for the compiler to assist in the generation and
management of the context data since it's already doing it. The
receiving function just needs a variable to receive and pass the context
data to the lambda.
-Steve
More information about the Digitalmars-d
mailing list