On Sunday, January 22, 2012 20:58:33 Walter Bright wrote: > Why make std.file support wchar and dchar? You triple the number of > functions, all for rarely used cases, and one where the user can trivially > convert wstring to string at the call site.
It doesn't triple the number of functions. You just templatize them. You only get triple the number of functions if you actually use them with all 3 string types. But we've had complaints in general about Phobos functions only supporting string rather than char[] or wstring or whatever. Templatizing std.file's functions on string types helps alleviate that. And on Windows, it would even allow you to pass a wstring without having to convert to a string first and then back to a wstring to pass to the Windows API functions, which could reduce that number of string operations required for file operations. Regardless, the idea is to make the functions more flexible. They don't _need_ to be restricted to string specifically. - Jonathan M Davis