On 12/20/11 5:17 AM, Froglegs wrote:
The array concatenation requiring GC I get, but why does a delegate
require it?
This link says D allocates closures on the heap
http://en.wikipedia.org/wiki/Anonymous_function#D
I don't really get why, C++ lambda works well(aside from broken lack of
template lambda's) and do not require heap usage, even binding it to
std::function can generally avoid it if it doesn't exceed the SBO size
Well another way of putting it is std::function MUST do heap allocation
if environment size exceeds the SBO size. It's the same thing here.
Just like C++ lambdas, D lambdas and local functions don't need heap
allocation unless they escape their scope.
Andrei