Let's get the semantic around closure fixed.

Ola Fosheim Grostad ola.fosheim.grostad at gmail.com
Wed May 19 19:59:52 UTC 2021


On Wednesday, 19 May 2021 at 19:48:52 UTC, Steven Schveighoffer 
wrote:
> e.g.:
>
> foreach(i; someLargeThing)
> {
>    if(Clock.currTime.year == 2020)// i.e. never
>      dg = {return  i;};
> }
>
> If we defensively allocate for the delegate, this is going to 
> allocate every iteration of someLargeThing, even though it's 
> very rare that it will need to.

Why not just use a backend intrinsic? The frontend does not have 
to know what the backend will do? Leave it to the 
implementation...




More information about the Digitalmars-d mailing list