-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add comments and clear up some of the code in preparation for SE-0021… #565
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Actually Daniel suggested that we don't keep this in filesystem/utility because clients almost always endup needing the entry name. If the method provides full path client will extract the basename from path which is a waste. So I put this method until we can refactor the PackageBuilder code to not use AbsolutePath at all. I should have added that FIXME here, my bad.
Uh oh!
There was an error while loading. Please reload this page.
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.
Why would PackageBuilder switch off of AbsolutePath? Would it just be using strings again?
Note that I'm not for a moment saying we should remove the ability to get the just the names of the entries: that's a fundamental building block of directory access. But instead of having every client construct their own AbsolutePaths, there should also be a way to iterate over subpaths.
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.
No no, it will use relative paths to the sources instead of absolute ones. So you can pass in a rerooted filesystem and get modules out of it.
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.
thats a typo above... *AbsolutePath -> absolute path
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.
Here is the discussion about rerooted fs: #521 (comment)
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 the link to #521. But it seems orthogonal to me, because part of the point of
FileSystemis that the client code (PackageBuilderin this case) shouldn't need to know or care whether it's given a file system that maps directly to the underlying file system, to a git repo orcpiofile or whatever, or to aRerootedFileSystemViewon top of one of those other kinds of file system.In all cases the API deals in terms of just paths (currently called
AbsolutePathbut eventually intending to be renamed toPath). And it doesn't change the fact that sometimes you want to walk a file system hierarchy. Other times you just want to get the names of the entries in a single directory.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.
A good way to think of it is as a stack of file systems. A
RerootedFileSystemViewjust means that you can pretend that everything exists at the top level of the file system, but other than that it isn't any different from any other file system.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.
We use absolute paths here because
Sourcestakes absolute paths, it can be refactored to contain only relative paths and only probably the module would be aware of its base path. After that point PackageLoader should be able to work with a rerooted fs. You're right this method is orthogonal to all this but once that is in, this function should not be needed anymore (ofcourse until we need this kind of facility somewhere else).