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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

clarify wording on args@ default handling #8596

Merged
merged 4 commits into from
Jul 19, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 6 additions & 8 deletions doc/manual/src/language/constructs.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,19 +217,17 @@ three kinds of patterns:

> **Warning**
>
> The `args@` expression is bound to the argument passed to the
> function which means that attributes with defaults that aren't
> explicitly specified in the function call won't cause an
> evaluation error, but won't exist in `args`.
>
> `args@` binds the name `args` to the attribute set that is passed to the function.
> In particular, `args` does *not* include any default values specified with `?` in the function's set pattern.
>
fricklerhandwerk marked this conversation as resolved.
Show resolved Hide resolved
> For instance
>
> ```nix
> let
> function = args@{ a ? 23, ... }: args;
> f = args@{ a ? 23, ... }: args;
fricklerhandwerk marked this conversation as resolved.
Show resolved Hide resolved
> in
> function {}
> ````
> f {}
> ```
>
> will evaluate to an empty attribute set.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> will evaluate to an empty attribute set.
> and both expressions will evaluate to:
>
> ```nix
> [ 23 {} ]
> ```


Expand Down