<div dir="auto"><div><div class="gmail_quote"><div dir="ltr">Am Fr., 16. Nov. 2018, 12:57 hat Ryan Joseph <<a href="mailto:ryan@thealchemistguild.com">ryan@thealchemistguild.com</a>> geschrieben:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
> On Nov 16, 2018, at 5:33 PM, Sven Barth via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org" target="_blank" rel="noreferrer">fpc-pascal@lists.freepascal.org</a>> wrote:<br>
> <br>
> When a function contains at least one anonymous function then a capture object is created which is shared by all anonymous functions in the function and also all captured local variables are moved there. If there is no variable to capture the capture object is nevertheless created. <br>
<br>
But is it an object on the heap with reference counting?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Yes. </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I read a number of articles on Lambda support in c++ and they seem to think in *some* instances the compiler can inline the lambda and see no speed penalty but they depends on it not being passed outside of the declaring scope. c++ may get away with this because you need to manually request captured variables.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">FPC could try that as well for such cases, but first and foremost it must work correctly for the general, unoptimized case. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote></div></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal" rel="noreferrer noreferrer" target="_blank"></a></blockquote></div></div></div>