On Thursday, 6 June 2013 at 15:36:17 UTC, Walter Bright wrote:
On 6/4/2013 11:27 PM, Dylan Knutson wrote:
I'd like to open up the idea of Path being an object in
std.path. I've submitted
a pull
(https://github.com/D-Programming-Language/phobos/pull/1333)
that adds a
Path struct to std.path, "which exposes a much more palatable
interface to path
string manipulation".
I've succumbed to the temptation to do this several times over
the years.
I always wind up backing it out and going back to strings.
As another data point: Java 7 introduces new Path and Paths
objects:
http://docs.oracle.com/javase/7/docs/api/java/nio/file/Paths.html
So they clearly think using an object(s) for it is useful.
-----
Without even thinking about the API, just using it, all the code
I've written in the past couple of weeks looks something like
this:
Path p = Paths.get(someDir, someOtherDir);
p = p.subpath(otherPath, p.getNameCount());
Path file = p.resolve(someFile);
print(file.toString());
file.toFile().doSomething();
ie. All my code is converting to/from a Path object purely for
dealing with Windows and Posix / vs \ differences and doing
sub-paths. Seems a bit pointless when we could just use free
functions in my opinion.