Path as an object in std.path

Lars T. Kyllingstad public at kyllingen.net
Thu Jun 6 09:06:49 PDT 2013


On Thursday, 6 June 2013 at 14:51:13 UTC, Dylan Knutson wrote:
> I should have said "makes it easier to be platform 
> independent". Normalization is done automatically on comparison.

Yes, p1 == p2 sure looks nice, but unbeknownst to the API user, 
it comes at the cost of several memory allocations, and it does 
not perform a case-insensitive comparison on Windows in its 
current form.  (Should it?  I dunno.)


> This isn't just conjecture either; there are D programs in the 
> wild that abstract away path strings because it's easier to 
> deal with them that way.
> I didn't want to force paths passed in to be valid, because the 
> programmer might want an invalid path passed around for 
> whatever reason.

As others have pointed out, there are examples of the opposite 
too.


> You came off as quite constructive; thank you :-)

:)


More information about the Digitalmars-d mailing list