Why is phobos so wack?

FoxyBrown via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 9 05:56:55 PDT 2017


import string.

...
return str.join(" ");


gives

Error: template std.array.join cannot deduce function from 
argument types !()(string, string), candidates are:
\..\..\src\phobos\std\array.d(1591):        std.array.join(RoR, 
R)(RoR ror, scope R sep) if (isInputRange!RoR && 
isInputRange!(Unqual!(ElementType!RoR)) && isInputRange!R && 
is(Unqual!(ElementType!(ElementType!RoR)) == 
Unqual!(ElementType!R)))
\..\..\src\phobos\std\array.d(1668):        std.array.join(RoR, 
E)(RoR ror, scope E sep) if (isInputRange!RoR && 
isInputRange!(Unqual!(ElementType!RoR)) && is(E : 
ElementType!(ElementType!RoR)))
\..\..\src\phobos\std\array.d(1754):        
std.array.join(RoR)(RoR ror) if (isInputRange!RoR && 
isInputRange!(Unqual!(ElementType!RoR)))

simply trying to join a string[] with a separator. I tend to get 
these types of errors when doing simple things in D. Virtually 
every other programming language just works as expected. You can 
pretty much just jump in there and pretty much guess at the 
function name, the arguments, and it will work. In Phobos, seems 
like it follows an anti-pattern. You always end up having to look 
at documentation unless you are familiar enough with D and use it 
in a regular basis to remember its quirks and odd behavior. Seems 
that the same functions are defined differently in different 
modules and the modules not always the expected ones. (strip is 
another one that throws me for a loop. I always try trim first... 
that is what everyone else uses, yeah, it's just a name, but then 
why strip?)

Phobos seems to be rather unorganized and not logically put 
together. Any hopes of this ever getting fixed or do I need to 
start putting together my own library?


More information about the Digitalmars-d mailing list