Skip to content

Commit

Permalink
doc: note that @-pattern is accessible in default values
Browse files Browse the repository at this point in the history
  • Loading branch information
fricklerhandwerk committed Oct 10, 2024
1 parent 4202d4f commit a780ce4
Showing 1 changed file with 17 additions and 0 deletions.
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.

> **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

0 comments on commit a780ce4

Please sign in to comment.