Idea for avoiding GC for lambdas

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Wed Jun 23 11:04:26 UTC 2021


On Tuesday, 22 June 2021 at 14:49:34 UTC, Steven Schveighoffer 
wrote:
> 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.

Off the top of my head:

I think it should just be an ordinary template parameter. Then 
you can let the compiler do the optimization if is possible 
without changing the semantics.

That way it isn't a language change.

So you could instead just introduce a UDA that signals that a 
compiler should issue a warning if it cannot do the optimization?

Or am I wrong?





More information about the Digitalmars-d mailing list