On 1/22/2012 11:08 PM, Jonathan M Davis wrote:
That happens anyway, because Phobos doesn't use .di files.
Phobos should use much more .di files. This will become more and more of an issue over time, as Phobos grows in complexity. We shouldn't preclude .di files.
Aside from the toMBSz issue, templatizing them costs essentially nothing on the implementation side and yet enables the programmer to pass in whatever string type they want.
Phobos1 had the secant and cosecant functions, which were dumped for Phobos2. You could make exactly the same argument for them. It is an insufficient rationale.
Phobos functions should do non-trivial things. It should not become an aggregation of trivia.
The only issue is that if you were using a .di file (which we're not, and won't, because it kills inlining and CTFE - though neither affects std.file much), you'd then have to have the implementation in the .di file whereas currently you don't.
I agree that inlining and CTFE is a complete non-issue for std.file. It is not the reason that std.file is not a .di file - the reason is that nobody bothered to do the work to make it one. It should be one.
Now, I don't think that it's all that big a deal that you have to convert whatever string type you're using to string to pass to functions in std.file, but I pretty always use string anyway. Other folks have complained in the newsgroup about the fact that Phobos functions generally force them to use string specifically.
Nobody is forced to use string. Just do a trivial conversion on calling the function. I emphasize trivial. A phobos function is even provided to do that - to!(string)(arg).
Note that std.regex is templatized on the string type. This is necessary because regex performance is critical. This rationale does not apply to std.file.