You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Proposed redesign of LocalBuildInfo and BuildTarget interface #3589
While working in the Cabal codebase, I noticed that we repeatedly want to treat these types as interconvertible: ComponentName, Component, ComponentLocalBuildInfo. There are two problems:
We keep doing goofy things like use the ComponentName to get the Component, then throw it out and later retrieve the Component again. Each of these is a linear scan over the components of the package description! So everything is inconvenient forever. Or we have finally gotten to a ComponentLocalBuildInfo, but then we want the ComponentName again.
It's not right in the Backpack world to treat ComponentLocalBuildInfo as interchangeable with ComponentName; the same component might get built multiple times.
BuildTarget goes through the trouble of getting out a module/filename that specifically was requested, at which point it is promptly discarded.
So, I propose we create a new data structure to bundle together Component, ComponentLocalBuildInfo, and the file target, and then consistently apply it to all functions in LocalBuildInfo right now. Let's call it TargetInfo. For example, componentsInBuildOrder can now get a new variant targetsInBuildOrder which deals in TargetInfos rather than ComponentLocalBuildInfos.
I think this should have minimal BC concerns, because it is an easy matter to keep all the old functions around.
Activity
23Skidoo commentedon Jul 22, 2016
Sounds sensible to me.
/cc @dcoutts
ezyang commentedon Jul 22, 2016
PR in #3595
jneira commentedon Jul 13, 2021
The mentioned pr is merged so I suppose this can be closed, @ezyang feel free to reopen if that is not the case