Path as an object in std.path

Lars T. Kyllingstad public at kyllingen.net
Thu Jun 6 08:24:08 PDT 2013


On Thursday, 6 June 2013 at 14:39:03 UTC, Dylan Knutson wrote:
> [...]
>
> I don't think that there'll be any performance improvements by 
> making in place modification functions. Considering under the 
> hood the path object is just a string, and that string's 
> reference needs to be changed with each modification, I don't 
> see how manipulation can be made faster.

Why does _path have to be an immutable string?  It could just as 
well be a char[], or it could be templated on the character type.

> [...]
>
> The more I think about it, the more partial I am to removing 
> the existing string methods in std.path. At most, using a Path 
> object increases number of characters typed by 6 (`Path()`). 
> And even then, chances are you'll be saving characters as 
> method names can be simplified to remove `path` from them: 
> buildNormalizedPath -> normalized, isValidPath -> isValid, etc. 
> Even with user code breaking, 1) D isn't exactly considered a 
> stable language quite yet; I'm sure that users expect code 
> breakage with each new release, and 2) it's trivial to convert 
> code that uses the string based API to the object based API.

I know D isn't 100% stable yet, but bear in mind that this module 
was introduced no more than two years ago, as part of the 
(still-ongoing) effort to revamp the old modules from the D1 
days.  It was accepted with a unanimous vote after a 
comprehensive review by the D community.  And already you want 
another breaking redesign?  I am strongly opposed to this.


More information about the Digitalmars-d mailing list