-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Fix typo in manual about options without defaults #25934
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
@nh2, thanks for your PR! By analyzing the history of the files in this pull request, we identified @ericsagnes, @grahamc and @thatdocslady to be potential reviewers. |
I can only guess at the author's intentions here, but I read "used" as meaning "declared": failing to declare a value for an option that has no default results in eval failure. With the proposed change, it reads more like you'll get an error if you refer to an option that has no default. |
@joachifm OK, let me first understand what really happens. For terminology, from the manual:
So declare means to Do I understand correctly that if you declare an option without Or is the behaviour that it fails independent of whether some code evaluates the option? CC @thatdocslady from the original wording. |
@nh2 Yes, that makes sense to me. I should have said "define" in my previous comment, to be consistent with the manual. |
I think it'd be an improvement to change the wording to some variation of "define" rather than "use". I agree it's unclear as written. |
@joachifm I've just built an example of what error message nix produces when this happens:
I've also tested what happens when you declare an option without Should I change the wording to e.g.
? |
Ah, juxtaposing the manual with the error message makes it clearer why it is worded that way. Taken on its own, I'm not so sure, though. Nix is supposed to be non-strict & it's reasonable to expect similar behavior from its module system, so I think the caveat "if x is evaluated/used" is redundant. I'd say something like "failing to define an option that lacks a default value is an error". When phrased that way it seems kind of self evident, however, suggesting it could be removed outright ... Anyway, I don't have strong feelings about this; if you find the manual helpful the way it is, then your clarification of what "use" means seems like an improvement to me. |
Also, you're absolutely right that it's a typo, so we can ofc merge this as is. |
@joachifm Good point. Here's another attempt for maximum clarity:
|
@nh2 makes sense to me :) Perhaps I'm the only one, but the use of "use" really confused me here, so for me this is much better. |
bf68043
to
aed1986
Compare
PR updated. |
Motivation for this change
Manual seems to have this the wrong way