Miscellaneous: Don't use mkEnableOption#18803
Miscellaneous: Don't use mkEnableOption#18803chris-martin wants to merge 1 commit intoNixOS:masterfrom
Conversation
|
@chris-martin, thanks for your PR! By analyzing the annotation information on this pull request, we identified @Profpatsch, @matthewbauer and @ehmry to be potential reviewers |
2c22dee to
0f94114
Compare
|
I'm ambivalent on this, but the "Fairbairn threshold" is a relevant term here: https://mail.haskell.org/pipermail/libraries/2012-February/017548.html |
|
Are we not squashing commits anymore? Since this is such a sweeping change, make sure that it is done before merge/cherry-pick. |
|
Agh, I wish I'd known that before I went through the effort to put these in separate commits. I thought the guideline was to separate commits affecting different packages. |
|
@chris-martin well, I'm not an absolutist, if it makes sense to "downgrade" expressions individually then separate commits are IMHO always in order. In this case however I don't think there is any reason for that, either we use mkEnableOption or not. Also for this PR to be complete you should take a pass over the documentation and make appropriate changes. |
0f94114 to
d38ab96
Compare
|
By the way, I've already found a handful of non-obvious mistakes such as |
|
Should we remove |
|
I'd say deprecate it at first
|
|
Wow, I really don’t like this change. I see no positive effect whatsoever, except for adding four lines of code to stuff that was pretty self-descriptive before. Now I’ll have to look up what argument fields options want instead, and will forget to set the default value half of the time. Strong 👎. |
|
@Profpatsch for positive effects, please read #18767 Note that you need to know argument fields options if you want to write NixOS modules. This change doesn't change this fact. And you still need understand We should make NixOS easier. Whole Nix language is designed on the fact it's a simple DSL for anyone to understand. |
|
note that easy and simple are not the same thing - this chnage makes things more simple the cost is removing a simple call the benefit is having a consistent comprehensible option pattern |
|
@Profpatsch there are different ways to look at this: Reading code➕ read 1 instead of 4 lines Writing code➕ write 1 instead of 4 lines if all default values are acceptable
➖ have to know about
|
|
I see the reasoning. Maybe it’s my gripe with the verbosity of module declaration in general, I still think there’s an abstraction slumbering in there that we should create. Editor templates can never be the solution imo. |
|
Another idea: What if we add a value like Then you can write That way you get both:
|
|
@chris-martin that would trade the extra function for an extra constant that one had to know / lookup. Imho that would be even worse.. |
|
@groxxda how is it different from having to look up most of the other functions people have put in As I said, I'm mostly ambivalent about this, but it seems like a weird line to draw in the sand and declare awful. To me it's on the edge of a useful abstraction. Back when we had Ultimately, I don't understand why people seem to care so much about something that feels so bikesheddy. If consensus is to remove it, I won't fight it, but it doesn't honestly seem that bad to me. |
|
If we had an API reference page, I'd be happier with #18526. |
|
I am against this change. We can write programs in any language with only basic functions and primitives. But we can also use libs and make our code easier to use and read. The same thing is with |
We're already talking about which side of the Fairbairn threshold this lies on - I don't think the absurdity is helpful. |
|
@chris-martin this function makes code better and easier to read. Also it motivates to read nix code a bit. This proposal is bad and I would like to reopen #18526 and merge it. |
This is a very subjective statement, having enable options the only ones declared in a different manner can be "worse" and "harder" to read for some, as modules declaration lose uniformity.
This 2 affirmations sounds a bit contradictory, it is ok to not use |
|
Let's continue the discussion on #18767, then decide which of these PRs to reopen and merge. |
This removes usages of
mkEnableOption(#18767).This is a work in progress. There are about a hundred more usages.