mirror of
https://github.com/NixOS/nix
synced 2025-07-12 19:05:08 +02:00
Add functors (callable attribute sets).
With this, attribute sets with a `__functor` attribute can be applied just like normal functions. This can be used to attach arbitrary metadata to a function without callers needing to treat it specially.
This commit is contained in:
parent
8cfe939b0f
commit
997defa166
4 changed files with 15 additions and 1 deletions
1
tests/lang/eval-okay-callable-attrs.exp
Normal file
1
tests/lang/eval-okay-callable-attrs.exp
Normal file
|
@ -0,0 +1 @@
|
|||
true
|
1
tests/lang/eval-okay-callable-attrs.nix
Normal file
1
tests/lang/eval-okay-callable-attrs.nix
Normal file
|
@ -0,0 +1 @@
|
|||
({ __functor = self: x: self.foo && x; foo = false; } // { foo = true; }) true
|
Loading…
Add table
Add a link
Reference in a new issue