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
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to