On 28/12/11 12:42 PM, bearophile wrote:
Peter Alexander:
I often get into situations where I've written
a function that takes a string, and then I can't call it because all I
have is a char[].
I suggest you to show some of such situations.
Any time you want to create a string without allocating memory.
char[N] buffer;
// write into buffer
// try to use buffer as string
I think it's telling that most Phobos functions use 'const(char)[]' or
'in char[]' instead of 'string' for their arguments. The ones that use
'string' are usually using it unnecessarily and should be fixed to use
const(char)[].
What are the Phobos functions that unnecessarily accept a string?
Good question. I can't see any just now, although I have come across
some in the past. Perhaps they have already been fixed.