Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
November 29, 2016 Code example in std.parallelism fails to compile | ||||
---|---|---|---|---|
| ||||
The code example at https://dlang.org/phobos/std_parallelism.html containing: import std.algorithm, std.parallelism, std.range; void main() { immutable n = 1_000_000_000; immutable delta = 1.0 / n; real getTerm(int i) { immutable x = ( i - 0.5 ) * delta; return delta / ( 1.0 + x * x ) ; } immutable pi = 4.0 * taskPool.reduce!"a + b"( std.algorithm.map!getTerm(iota(n)) ); } fails to compile as std/parallelism.d(2632,36): Error: function std.parallelism.TaskPool.reduce!"a + b".reduce!(MapResult!(getTerm, Result)).reduce cannot get frame pointer to D main on Git master. Why? Is there a solution? |
November 29, 2016 Re: Code example in std.parallelism fails to compile | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | Not that I know of, https://github.com/dlang/phobos/pull/4399. I think std.parallelism was designed around a D feature that was more a bug than a feature. This bug/feature seamed to be fixed some years ago. But I'm not 100%, as this was before my time. |
November 29, 2016 Re: Code example in std.parallelism fails to compile | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On Tuesday, 29 November 2016 at 12:09:32 UTC, Nordlöw wrote: > Is there a solution? I've reported the issue recently https://issues.dlang.org/show_bug.cgi?id=16705. |
November 29, 2016 Re: Code example in std.parallelism fails to compile | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On Tuesday, 29 November 2016 at 12:09:32 UTC, Nordlöw wrote:
> The code example at https://dlang.org/phobos/std_parallelism.html
>
> containing:
>
>
> import std.algorithm, std.parallelism, std.range;
>
> void main() {
> immutable n = 1_000_000_000;
> immutable delta = 1.0 / n;
>
> real getTerm(int i)
> {
> immutable x = ( i - 0.5 ) * delta;
> return delta / ( 1.0 + x * x ) ;
> }
>
> immutable pi = 4.0 * taskPool.reduce!"a + b"(
> std.algorithm.map!getTerm(iota(n))
> );
> }
>
> fails to compile as
>
> std/parallelism.d(2632,36): Error: function std.parallelism.TaskPool.reduce!"a + b".reduce!(MapResult!(getTerm, Result)).reduce cannot get frame pointer to D main
>
> on Git master.
>
> Why?
>
> Is there a solution?
Define the function you want to call globally.
and not inside another function.
|
November 29, 2016 Re: Code example in std.parallelism fails to compile | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Tuesday, 29 November 2016 at 12:49:53 UTC, Stefan Koch wrote: > Define the function you want to call globally. > and not inside another function. Yes. You can also find a very detailed explanation here https://github.com/dlang/phobos/pull/4915#issuecomment-262484753. |
Copyright © 1999-2021 by the D Language Foundation