digitalmars.D - Code example in std.parallelism fails to compile
- =?UTF-8?B?Tm9yZGzDtnc=?= (23/23) Nov 29 2016 The code example at https://dlang.org/phobos/std_parallelism.html
- Robert burner Schadek (4/4) Nov 29 2016 Not that I know of, https://github.com/dlang/phobos/pull/4399. I
- Mihai (3/4) Nov 29 2016 I've reported the issue recently
- Stefan Koch (3/27) Nov 29 2016 Define the function you want to call globally.
- Mihai (3/5) Nov 29 2016 Yes. You can also find a very detailed explanation here
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?
Nov 29 2016
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.
Nov 29 2016
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.
Nov 29 2016
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.
Nov 29 2016
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.
Nov 29 2016