Compiler analysis of single-use types? Escape analysis of types?

Yuxuan Shui via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 17 18:21:07 PDT 2016


On Thursday, 18 August 2016 at 00:59:43 UTC, Dicebot wrote:
> On 08/18/2016 12:25 AM, Ali Çehreli wrote:
>> [...]
>
> I believe actual reason is that aliased lambda has to allocate 
> a closure because it refers to stack local variable (limit). 
> This compiles just fine:
>
> auto countAbove(int[] a, int limit) @nogc {
>     return a.filter!(x => x >= 1).count();
> }

I wish we could have something like "scoped" delegates...


More information about the Digitalmars-d mailing list