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: note that @-pattern is accessible in default values #11672

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions doc/manual/src/language/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,23 @@ three kinds of patterns:
> [ 23 {} ]
> ```

The complete function argument denoted as an `@`-pattern can be accessed inside default values.
fricklerhandwerk marked this conversation as resolved.
Show resolved Hide resolved

> **Example**
>
> ```nix
> let
> f = args@{ x ? args.a, ... }: x;
> in
> f { a = 1; }
> ```
>
> evaluates to
>
> ```nix
> 1
> ```

Note that functions do not have names. If you want to give them a name,
you can bind them to an attribute, e.g.,

Expand Down
Loading