i just had a scenario like the one below. when calling .array on the filterresult dmd goes nuts because of the init() function in Players. Renaming to initialize() solved the problem.

Solution: As .init is used for struct initialization and such (https://dlang.org/spec/property.html#init) i think it should be a restricted keyword for class members and methods

experienced programmers ofc know that .init is used in special ways and avoid it. newcomers like me have a hard time with such cases.

class Players
{
  void init() { ... }

  ...
}

auto candidates = players.filter!(x => {
  return x.active && x.getName().indexOf(searchstring) > -1;
}).array;



Reply via email to