Value closures (no GC allocation)
Ali Çehreli via Digitalmars-d
digitalmars-d at puremagic.com
Sun May 21 09:10:36 PDT 2017
Hi Vittorio, wonderful to see you here after C++Now! :)
On 05/20/2017 09:08 PM, Vittorio Romeo wrote:
>consider this code:
>
> void delegate()[] arr;
>
> foreach(i; 0..5)
> {
> arr ~= () => writeln(i);
> }
>
> foreach(f; arr)
> {
> f();
> }
>
> This is going to print "4 4 4 4", which might be the desired behavior.
It's a bug. :/
https://issues.dlang.org/show_bug.cgi?id=8621
Ali
More information about the Digitalmars-d
mailing list