-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#18 implement behavior to calculate parents from exclusively-relative paths #83
#18 implement behavior to calculate parents from exclusively-relative paths #83
Conversation
Thanks for a thorough investigation! I agree that returning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far I have extracted the following checklist:
- See what about the absolute path
- Remove
Random
from tests - Document this behavior
- Fix
ResolveRelativePaths
- Essentially, it detects if a path is a relative-only
- Perhaps there's a better way of detecting it on a normalized path? Say, just check if it ends with
{separator}..
- Rename and move appropriately
- Add a test case for
foo
that should resolve to.
- Test paths like
.../...
— should work as before
We can discuss and you can fix some of these if you want, otherwise I'm planning to work on these items after the next release myself.
After some thought, I decided that we should go with the following invariant: calling This will create some nice properties: say, I'll work on updating this PR. Footnotes
|
- Fix bad naming
…arent calculation
4a076bc
to
63f8440
Compare
01fe1d8
to
079747c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your investigation and initial implementation! I make sure to credit you properly in the release notes.
Closes #18.
Pull Request: Define Parent for LocalPath(".") and Relative Paths
Problem Description:
Currently,
new LocalPath(".").Parent
(similarly for paths like..
or../..
) is not defined. This creates ambiguity and inconsistency in the behavior of the library.Proposed Solution:
After researching how other libraries handle the parent of paths such as
"."
,".."
, and"../.."
, we propose that these should returnnull
. This approach aligns with the general expectations and behavior seen in other path-handling libraries.Changes Made:
null
for the parent ofLocalPath(".")
,LocalPath("..")
, and other relative paths.Rationale:
It's important to note that the decision to return
null
is debatable. Here are some examples of how different languages handle these cases:Python:
Go:
Java:
C#:
Rust:
If you look behind the trends, you can see that modern, trendy languages try to reclaim the solved path or treat it fairly with this kind of behaviour.
Bottom line, I definitely can't claim that returning null is a good idea