You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
yunfachi opened this issue
May 1, 2024
· 1 comment
Labels
breakingChanges we can't make without breaking old expressions, changing hashes, etcfeatureFeature request or proposallanguageThe Nix expression language; parser, interpreter, primops, evaluation, etc
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; }
yunfachi
changed the title
Optional set attributes of a function are not binded with the set
Optional set attributes of a function should be included when binding the set
May 1, 2024
roberth
added
language
The Nix expression language; parser, interpreter, primops, evaluation, etc
breaking
Changes we can't make without breaking old expressions, changing hashes, etc
labels
Jul 5, 2024
Unfortunately this is not something we can change without causing many expressions to break, which is a no-go for Nix.
Perhaps with a versioned language we could change this, but even then I'd be careful about making the entirety of the language (all versions) more complex.
An alternative that is feasible without versioning the language is to add a new syntax, such as #8636.
I'll add the breaking label so we can find this later, but I'll close it for now because it's not actionable for now.
breakingChanges we can't make without breaking old expressions, changing hashes, etcfeatureFeature request or proposallanguageThe Nix expression language; parser, interpreter, primops, evaluation, etc
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
Priorities
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: