[Issue 12811] GC-allocated closure for calling instance function in filter
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Mar 26 17:51:34 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=12811
--- Comment #2 from bearophile_hugs at eml.cc ---
(In reply to Kenji Hara from comment #1)
> 'filter' will lazily evaluate the given array outside of the 'spam'
> function, so the lambda 'i => bar(i)' needs to capture 'this' variable to
> call member function 'bar'.
>
> It will make a closure allocation.
Thank you for the answer. We'll have to add some escape analysis to turn some
closure heap allocations into stack allocations.
--
More information about the Digitalmars-d-bugs
mailing list