Skip to content
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

doc: clarify that optional attrs in a function argument will be ignored unless specified #2880

Merged
merged 1 commit into from May 22, 2019

Conversation

Ma27
Copy link
Member

@Ma27 Ma27 commented May 20, 2019

In args@{ a ? 1 }: /* ... */ the value a won't be a part of args
unless it's specified when calling the function, the default value will
be ignored in this case.

My personal point of view is that this behavior is a matter of taste, at
least I was pretty sure that unmatched arguments will be a part of
args@ while debugging some Nix code last week.

I decided to add a warning to the docs which hopefully reduces the
confusion of further Nix developers who thought the same about args@.

doc/manual/expressions/language-constructs.xml Outdated Show resolved Hide resolved
doc/manual/expressions/language-constructs.xml Outdated Show resolved Hide resolved
doc/manual/expressions/language-constructs.xml Outdated Show resolved Hide resolved
…ed unless specified

In `args@{ a ? 1 }: /* ... */` the value `a` won't be a part of `args`
unless it's specified when calling the function, the default value will
be ignored in this case.

My personal point of view is that this behavior is a matter of taste, at
least I was pretty sure that unmatched arguments will be a part of
`args@` while debugging some Nix code last week.

I decided to add a warning to the docs which hopefully reduces the
confusion of further Nix developers who thought the same about `args@`.
@Ma27 Ma27 force-pushed the document-optional-attrs-with-at-pattern branch from 6b7f70b to b502b66 Compare May 21, 2019 16:08
@Ma27
Copy link
Member Author

Ma27 commented May 21, 2019

@edolstra thanks a lot for the review! I've just addressed all comments. Anything else? :)

@edolstra edolstra merged commit bfc6bdf into NixOS:master May 22, 2019
@Ma27 Ma27 deleted the document-optional-attrs-with-at-pattern branch May 22, 2019 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants