chunkBy bug?

JG g at g.com
Mon Sep 7 19:14:57 UTC 2020


On Sunday, 6 September 2020 at 17:08:06 UTC, Seb wrote:

> It's hard to read this and compare against the original 
> implementation here.
> If this issue still persists with master, why don't you simply 
> open a PR for Phobos?
> Bug fixes are always welcome!

I compiled dmd and phobos from source. Using the same code as 
before:
----
import std.algorithm;
import std.range;
import std.stdio;

void main() {
  auto v = [2,4,8,3,6,9,1,5,7];
  foreach(i; 2..4) {
   writeln(v.myChunkBy!((a,b)=>a%i==b%i));
  }
}
----
and  compiling with the new version of dmd produces:

../../dlang/dmd/generated/osx/release/64/../../../../../phobos/std/algorithm/iteration.d(2058): Error: function chunkByFix.main.ChunkByImpl!(__lambda1, int[]).ChunkByImpl.Group.popFront cannot access delegate __lambda1 in frame of function D main

I will see if I can figure out how to attempt a PR for phobos.



More information about the Digitalmars-d mailing list