Path as an object in std.path

Lars T. Kyllingstad public at kyllingen.net
Thu Jun 6 10:15:10 PDT 2013


On Thursday, 6 June 2013 at 16:14:31 UTC, Dylan Knutson wrote:
> On Thursday, 6 June 2013 at 16:06:50 UTC, Lars T. Kyllingstad 
> wrote:
> It doesn't do any allocations that the user won't have to do 
> anyways. Paths have to be normalized before comparison; not 
> doing so isn't correct behavior. Eg, the strings `foo../bar` != 
> `bar`, yet they're equivalent paths. Path encapsulates the 
> behavior. So it's the difference between
>
> buildNormalizedPath(s1) == buildNormalizedPath(s2);
>
> and
>
> p1 == p2;

To me, at least, the first one practically screams "expensive 
operation", whereas the second one does the exact opposite.


More information about the Digitalmars-d mailing list