-
Notifications
You must be signed in to change notification settings - Fork 696
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
LocalBuildInfo fields are poorly named or designed #3597
Comments
|
2 and 3 sound good. |
I was thinking of removing the prefixes entirely and using RecordWildCards, i.e.
to facilitate I actually don't like how similar they are to the configure flags' names; they are emphatically NOT the flags passed to configure. In fact, we have some code that skims the |
My uninformed opinion about record wild cards is they should only be used when it is manifestly obvious where the names come from. Otherwise I find it is too confusing to figure out the binding site of a record wild card. |
I agree, but I think that it is unambiguous because the |
I mean, I'm not going to block you from using record wild cards if you really want to, but I will personally only use them in boilery-platey code; if it's a function like |
Well, I will think more about how best to do this. It's not much of a "solution" if it doesn't meet everyone's needs! RecordWildCards was also my boilerplate-reduction strategy for the command-line flag structs. I definitely want to get this right; there's no need for haste! |
I think the biggest problem people frequently have with RecordWildCards is that these bindings do shadow, and Cabal currently strives to be shadow free. |
Separating the program config is absolutely the right thing to do. The only reason they're currently mixed up was to avoid breaking the user hooks API. |
Problems
with
fieldsThese field names have the prefix
with
:withPrograms :: ProgramConfiguration
withPackageDB :: PackageDBStack
withVanillaLib :: Bool
withProfLib :: Bool
withSharedLib :: Bool
withDynExe :: Bool
withProfExe :: Bool
withProfLibDetail :: ProfDetailLevel
withProfExeDetail :: ProfDetailLevel
withOptimization :: OptimisationLevel
withDebugInfo :: DebugInfoLevel
withGHCiLib :: Bool
In usual Haskell parlance,
with
indicates a function in continuation passing style, but these are simple accessors.Singular/Plural
These fields refer to executables, libraries, or package databases in the singular, which is incorrect because we handle multiple of each simultaneously:
withPackageDB :: PackageDBStack
withVanillaLib :: Bool
withProfLib :: Bool
withSharedLib :: Bool
withDynExe :: Bool
withProfExe :: Bool
withProfLibDetail :: ProfDetailLevel
withProfExeDetail :: ProfDetailLevel
Duplicated fields
We have
withProfLib :: Bool
andwithProfLibDetail :: ProfDetailLevel
withProfExe :: Bool
andwithProfExeDetail :: ProfDetailLevel
when
libProfiling :: Maybe ProfDetailLevel
andexeProfiling :: Maybe ProfDetailLevel
would be more idiomatic.Essentially-unused fields
The program configuration in
withPrograms :: ProgramConfiguration
can't actually be serialized. Also, the programs in use can and often are reconfigured after the package is configured! Package configuration and program configuration are separate issues.Proposed Solutions
with
-prefixed fields.libProfiling :: Maybe ProfDetailLevel
andexeProfiling :: Maybe ProfDetailLevel
.LocalBuildInfo
intoPackageConfig
(which would have most of the same fields asLocalBuildInfo
) and a separateProgramConfiguration
.Compatibility
I can add deprecated accessors for all the renamed and removed fields. However, code which assigns those fields will have to change.
Splitting up
LocalBuildInfo
internally does not need to affect external code because we can always reconstruct aLocalBuildInfo
for legacy interfaces.The text was updated successfully, but these errors were encountered: