-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
lib: add missing removeAttrs builtin #227124
Conversation
I'm expecting all the builtins.* functions to be available in lib.*
Coincidentally very relevant is @roberth's comment here:
And I agree with this. So instead of just propagating builtins I'd rather make sure the name and interface of the function is correct, and only using the builtin for speed underneath. And this is a great example, because
Unfortunately just flipping around the order for |
To me, I agree that the ordering of the arguments is not intuitive. There are always weird corners in languages and historical accidents. You learn them by heart and live with them, it's not a big deal. As you noted, it would be even worse if the ordering was reversed in |
Here is an effort I started a while back to re-think the stdlib entirely, with a proper categorization effort. And reversed removeAttrs arguments: https://github.com/numtide/nix-stdlib/blob/main/src/types/attrs.nix#L21-L22 |
Not curry friendly, I agree. How about a new name for the flipped version? |
I'm sorry; this PR was supposed to be a trivial change that would be merged in. We already agree that If you want to re-think how the lib is structured, then let's have that conversation. But holistically and in a separate space. For example, if we had per-type prefixes like |
No need for anyone to feel sorry or apologize. It's good to have a conversation, so that we've considered the broader context of the change. I think this PR is a good step forward. Using a different name is just a suggestion that can be executed on independently of this PR if you prefer it that way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've considered the alternatives, and I think by adding a function with a new name we can solve the currying issue of the existing, established function. As mentioned, changing the meaning without changing the name would be rather confusing, so this PR is a net positive and does not lead to an unnecessarily local optimum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair points, agreed :)
Successfully created backport PR for |
Description of changes
I'm expecting all the builtins.* functions to be available in lib.*
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)