Hi,
I had a question on how to control how variables are captured in Chapel's
lambda functions. Currently, it looks like the variables are all captured by
reference (at least this is what I see in the generated C code). This is
problematic if we have asynchronous lambda functions used in conjunction with
Futures.async or Futures.andThen, because the asynchronous lambda function may
execute at a point when the calling context has already been popped off the
stack. A classic example is the loop index that the async lambda captures by
reference will be invalid when the lambda actually executes.
My question is how to capture the external variables by value in lambdas,
similar to how it can be done in C++ using the following lambda capture
notations [=] and [&].
Regards,
Ashwin
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers