ForNeVeR/TruePath

`AbsolutePath::Parent` should not re-check the path's absoluteness

ForNeVeR opened this issue · 2 comments

Current implementation of AbsolutePath::Parent just creates a new AbsolutePath instance, which will perform a check for path's absoluteness (absolution?).

We should consider optimizing that case, since a parent of a known absolute path is guaranteed to be absolute itself (if it is present at all).

Perhaps introduce an private method to create instances of AbsolutePath unchecked?

See TODO[#17] in the code when implementing this.

i think that there may be a designated private constructor, that has a parameter specifying whether the absoluteness of the path should be checked, with signature like so:

private AbsolutePath(string path, bool checkAbsolutenness)

thus all existing constructors will invoke it with flag set to true and when we create a path in Parent property it would be set to false

does this solution align with your vision for the library?

Yeah, that sounds okay.