Passing Function as an argument to another Function

Jonathan M Davis newsgroup.d at jmdavisprog.com
Tue Dec 5 02:35:17 UTC 2017


On Monday, December 04, 2017 20:02:30 kdevel via Digitalmars-d-learn wrote:
> On Monday, 4 December 2017 at 11:05:22 UTC, Vino wrote:
> > On Monday, 4 December 2017 at 10:46:03 UTC, rikki cattermole
> > wrote:
> >
> > FunTest.d(52): Error: template FunTest.ptProcessFiles cannot
> > deduce function from argument types !()(string,
> > Array!(Tuple!(string, string)) function(string FFs,
> >
> >  string Step, int DirAged), File, File, string, int),
> >
> > candidates are:
> > FunTest.d(24):        FunTest.ptProcessFiles()(Array!string
> > Dirlst, Array!(Tuple!(string, string)) function(string, string,
> > int) coRoutine, File logF, File logE
> > , string Step, int Aged)
> > Failed: ["dmd", "-v", "-o-", "FunTest.d", "-I."]
>
> Why do I get a different error?:
>
> .../linux/bin64/../../src/phobos/std/datetime.d(106): Error:
> module std.datetime from file
> .../linux/bin64/../../src/phobos/std/datetime.d conflicts with
> package name datetime

That implies you have a borked install of dmd. How did you install it? You
didn't do something like unzip a newer release on top of an older one did
you? If you're using the zip file to install dmd, you have to blow away the
previous install before copying over the new one, or you're screwed anytime
that files get removed or moved around. I wouldn't expect that particular
error if dmd were installed via the package manager.

In 2.076.0, std.datetime was split into a package. So, if you somehow ended
up with both the old files and new ones, there's a conflict. With 2.076.0,
it could result in linker problems, because the compiler didn't properly
detected it, but it was since fixed so that the compiler sees that you have
both module and a package of the same name and gives an error.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list