On 12/28/11 13:42, 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. > > >> 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?
eg things like std.demangle? (which wraps core.demangle and that one accepts const(char)[]). IIRC eg the stdio functions taking file names want strings too; never investigated if they really need this, just .iduped the args... In general, a lot of things break when trying to switch to "proper" const(char)[] in apps, usually because the app itself used "string" instead of the const version, but fixing it up often also uncovers lib API issues. artur
