[phobos] std.path proof of concept
Lars Tandle Kyllingstad
lars at kyllingen.net
Fri Apr 23 07:51:12 PDT 2010
I am convinced that what I've proposed is a good idea, so I made a tiny
proof-of-concept version of the module.
In fact, I found an even better way to do it: Instead of putting the
functions inside structs, I just have one template of which the
appropriate instantiation is mixed into the module scope. So, on Windows,
getDirectory("c:\\foo\\bar.txt") --> "c:\\foo"
Path!Posix.getDirectory("/foo/bar.txt") --> "/foo"
In this way, there is no code duplication and no more work for the
library maintainer, only more flexibility for the user. Check out the
code and documentation if you don't believe me:
http://github.com/kyllingstad/ltk/blob/master/ltk/path.d
http://kyllingen.net/code/ltk/doc/path.html
-Lars
More information about the phobos
mailing list