-
Notifications
You must be signed in to change notification settings - Fork 712
Distinguish between component ID and unit ID. #3047
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
Conversation
Do you want this to go into 1.24? |
Yes, we'll release GHC 8.0 with it. |
Note: Cabal library changes should be good, but I need to work out some details for cabal-install. Will update shortly. |
Should be ready. |
I started to review this, but realized just how big it is[1]... any chance it could be split up a little bit? (The removal of IPI641 would seem like a reasonable candidate at least.) I realize that you've probably already tried to, but it can't hurt to ask... [1] I probably couldn't contribute much in-depth review commentary anyway, but... |
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Backpack is going to have to rewrite this functionality. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
GHC 8.0 is switching the state sponsored way to specify linker names from -this-package-key to -this-unit-id, so it behooves us to use the right one. But it didn't make much sense to pass ComponentIds to a flag named UnitId, so I went ahead and finished a (planned) refactoring to distinguish ComponentIds from UnitIds. At the moment, there is NO difference between a ComponentId and a UnitId; they are identical. But semantically, a component ID records what sources/flags we chose (giving us enough information to typecheck a package), whereas a unit ID records the component ID as well as how holes were instantiated (giving us enough information to build it.) MOST code in the Cabal library wants unit IDs, but there are a few places (macros and configuration) where we really do want a component ID. Some other refactorings that got caught up in here: - Changed the type of componentCompatPackageKey to String, reflecting the fact that it's not truly a UnitId or ComponentId. - Changed the behavior of CURRENT_PACKAGE_KEY to unconditionally give the compatibility package key, which is actually what you want if you're using it for the template Haskell trick. I also added a CURRENT_COMPONENT_ID macro for the actual component ID, which is something that the Cabal test-suite will find useful. - Added the correct feature test for GHC 8.0 ("Uses unit IDs"). Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
I separated out some bits but I'm not sure it helps very much. Not sure if the intermediate commits build. |
I'm not sure if this is general policy for this project, but would you mind triggering a build for each of them? Alternatively I suppose it might be possible to just create a PR for each? (I realize that this is annoying, but I guess we'll have to like with it if we want to make sure commits build individually.) (It can get really annoying when bisecting that a really big commit next to the prime suspect doesn't build.) |
... and actually, thinking about it a little more: It might be fine to actually NOT bother trying to build but to just leave this as four commits until review is done and then to re-squash before merge. That way there aren't any weird compatibility effects either, etc. |
Well, the three "Remove ..." commits certainly LGTM. I don't have time to review the really big one right now, but will try to do it a little later today. |
(And I may not be the best to review this, so I'd encourage others to review too...) |
(Mark. End of review) |
We don't have a formal policy, but we've never been strict about this. Bisect allows ignoring broken commits, so personally I'm okay with imposing this cost on the person doing bisect instead of each and every contributor. Don't see any other disadvantages besides slightly worse bisect experience to having potentially broken commits in history.
Personally I prefer a history composed of smaller self-contained commits instead of large monolithic ones.
Please don't do that, related changes should be grouped together. |
OK. I don't necessarily agree, but it's probably not worth fighting over :). |
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Btw, if you use the setup-dev.sh script it should be pretty easy to check if things at least build locally. (There's a caveat in that tests are currently not run if you do this, but they should be built.) |
LGTM, let's merge. |
Distinguish between component ID and unit ID.
GHC 8.0 is switching the state sponsored way to specify
linker names from -this-package-key to -this-unit-id, so
it behooves us to use the right one. But it didn't make
much sense to pass ComponentIds to a flag named UnitId,
so I went ahead and finished a (planned) refactoring
to distinguish ComponentIds from UnitIds.
At the moment, there is NO difference between a ComponentId
and a UnitId; they are identical. But semantically, a
component ID records what sources/flags we chose (giving us enough
information to typecheck a package), whereas a unit ID records
the component ID as well as how holes were instantiated
(giving us enough information to build it.) MOST code
in the Cabal library wants unit IDs, but there are a few
places (macros and configuration) where we really do
want a component ID.
Some other refactorings that got caught up in here:
Signed-off-by: Edward Z. Yang ezyang@cs.stanford.edu