NixOS / nix

Nix, the purely functional package manager

Home Page:https://nixos.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Optional set attributes of a function should be included when binding the set

yunfachi opened this issue · comments

Is your feature request related to a problem? Please describe.
When I bind a set with optional attributes, I expect this set to have all required, ignored, specified optional, and unspecified optional attributes, but it only has all required, ignored, and specified optional attributes.

Describe the solution you'd like
When binding a set, unspecified optional attributes should be included.

Describe alternatives you've considered
Creating a new set by inheriting all attributes. For example:
({x, y ? 10}: {inherit x y;}) (x=5;) = { x = 5; y = 10; }

Additional context
In my opinion, they should return the same result, but unspecified attributes are not included

nix-repl> ({x, y ? 10}: {inherit x y;}) {x=5;}
{ x = 5; y = 10; }

nix-repl> ({x, y ? 10} @ args: args) {x=5;} 
{ x = 5; }

Priorities

Add 👍 to issues you find important.