Troubles with taskPool.amap, lambdas and more

Vladimir Panteleev vladimir at thecybershadow.net
Thu Mar 20 23:00:35 PDT 2014


On Wednesday, 19 March 2014 at 00:13:10 UTC, bearophile wrote:
> A problem (that is not a regression) is that taskPool.amap 
> doesn't seem able to accept a lambda for some reason.

The reason for that is that any function in D currently can have 
at most one context pointer. For class and struct methods, that 
is the "this" pointer. For free functions which take a lambda, 
such as "map", "reduce" and other std.algorithm functions, it is 
the context of the lambda (a pointer to the containing function's 
stack frame or whatnot).

You can't have both.

I think this is a glaring design problem in std.parallelism.

> But even using a normal static inner function, the program 
> asserts most times at run-time (but not always), while few 
> months ago it used to work reliably. So perhaps in this messy 
> situation there's some material for bug reports. Opinions and 
> suggestions are welcome.

Can you perform a regression test, or post the asserting program?


More information about the Digitalmars-d-learn mailing list