Proof of concept for removing ConstantResolver and using Zeitwerk for ConstantDiscovery#410
Open
Catsuko wants to merge 4 commits intoShopify:mainfrom
Open
Proof of concept for removing ConstantResolver and using Zeitwerk for ConstantDiscovery#410Catsuko wants to merge 4 commits intoShopify:mainfrom
Catsuko wants to merge 4 commits intoShopify:mainfrom
Conversation
Catsuko
commented
Jul 18, 2024
| spec.add_dependency("parallel") | ||
| spec.add_dependency("sorbet-runtime", ">= 0.5.9914") | ||
| spec.add_dependency("zeitwerk", ">= 2.6.1") | ||
| spec.add_dependency("zeitwerk", ">= 2.6.14") |
Author
There was a problem hiding this comment.
For usage of Zeitwerk::Loader#all_expected_cpaths: https://github.com/fxn/zeitwerk/blob/main/CHANGELOG.md#2614-14-may-2024
Author
|
I have signed the CLA! |
Catsuko
commented
Jul 18, 2024
Author
There was a problem hiding this comment.
For an easier to understand idea of the zeitwerk implementation, see this commit.
|
👋 We'd love if this got merged, it would give us a lot more flexibility in how we organize our files. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What are you trying to accomplish?
I am interested in using Zeitwerk features such as collapsing directories however currently Packwerk doesn't support this.
Based on this comment in a related issue, this PR adds an implementation of
ConstantDiscoveryusing Zeitwerk rather thanConstantResolveras a proof of concept.What approach did you choose and why?
First I refactored to encapsulate
ConstantResolverso it is easier for me to play with an alternateConstantDiscoveryimplementation.Then I implemented a Zeitwerk based
ConstantDiscoveryand copied tests fromConstantDiscoveryand theConstantResolvergem to make sure it worked ok. Private methods for matching constants from the map of paths was taken from ConstantResolver as well as many tests checking edge cases.Finally I replaced
ConstantDiscoverywith my version and removed the code related to the old implementation. A lot of test helpers needed to be updated here since nowConstantDiscoverydepends on Zeitwerk Loaders 😭What should reviewers focus on?
Type of Change
Checklist