string and char[] in Phobos

Puming via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Mar 18 01:24:24 PDT 2016


Hi,

I saw from the forum that functions with string like arguments 
better use `in char[]` instead of `string` type, because then it 
can accept both string and char[] types.

But recently when actually using D, I found that many phobos 
functions/constructors use `string`, while many returns `char[]`, 
causing me to do a lot of conv.to!string. And many times I have 
to fight with the excessive template error messages.

Is there a reason to use `string` instead of `in char[]` in 
function arguments? Do you tend to change those phobos functions?


More information about the Digitalmars-d-learn mailing list