std.path review: update

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Sun Jul 17 14:27:41 PDT 2011


Based on your comments, I have made some changes to my std.path 
proposal.  A list of the changes I have made can be found at the 
following address (look at the commits dated 2011-07-17):

  https://github.com/kyllingstad/phobos/commits/std-path

I believe I have covered most of your requests, with a few exceptions:

Firstly, Jonathan argued very convincingly that the contents of the 
current std.path should be put back in, marked as "scheduled for 
deprecation".  I intend to do this when the review is over, if my 
submission gets accepted.  For now, ignore the bottommost deprecated: 
block.

Secondly, David and Jonathan suggested I optimise functions like 
setExtension() using ~= to append when possible.  I have tried doing so 
for setExtension(), and I'm not convinced the extra complexity is worth 
the relatively modest gain.  The specialised, optimised version can be 
found here:

  https://github.com/kyllingstad/phobos/blob/std-path/std/path.d#L529

Finally, there are some requests with which I don't personally agree.  
Therefore, I'd like to get more opinions before making any changes:

- Should I add toNativePath(), which replaces '/' with '\' on Windows and 
vice versa on POSIX?

- Should it be specified/documented whether a function returns "" or 
null?  Specifically, is it important that

    extension("foo") is null
    extension("foo.") !is null && extension("foo.") == ""

- Do people agree with Jonathan's views on function names?


As before, code and docs can be found here:

https://github.com/kyllingstad/phobos/blob/std-path/std/path.d
http://www.kyllingen.net/code/new-std-path/phobos-prerelease/std_path.html

-Lars


More information about the Digitalmars-d mailing list