std.path review: final version(?)

Jonathan M Davis jmdavisProg at gmx.com
Fri Aug 12 01:31:25 PDT 2011


On Friday, August 12, 2011 10:14:11 Rainer Schuetze wrote:
> I like how std.path has turned out. Thanks, Lars.
> 
> Two minor issues while skipping through the source (I've been on
> vacation, and it took some time to catch up, so I'm not sure these have
> already been discussed):
> 
> - C[] baseName(C, C1)(C[] path, C1[] suffix) does not respect the case
> sensitivity of the OS with respect to suffix, I think it should.
> 
> - string absolutePath(string path, string base) returns an empty string
> if path is empty. I would have expected that the base directory is
> returned, so that you'll always get a sensible path.

Except, you gave it an invalid path if you gave it an empty string. Such a bug 
would be found faster if you get an invalid path back than if you get the base 
directory. I definitely think that if you give an invalid path to a function, 
it's better to get an invalid path back out. Otherwise, it's just hiding bugs, 
making them hard to catch and debug.

- Jonathan M Davis


More information about the Digitalmars-d mailing list