Skip to content
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

treewide: remove isNull where it decreases readability and code understanding #275548

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SuperSandro2000
Copy link
Member

@SuperSandro2000 SuperSandro2000 commented Dec 20, 2023

Description of changes

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎 on this. There's general agreement that it shouldn't be deprecated in NixOS/nix#8264

Edit: Now opened NixOS/nix#9645 to undeprecate it

infinisil added a commit to tweag/nix that referenced this pull request Dec 20, 2023
There's no good reason to deprecate it:
- For consistency reasons it should continue to exist, such that all
primitive types have a corresponding `builtins.is*` primop.
- There's no implementation cost to continuing to have this function
- It costs users time to try to migrate away from it, e.g.
  NixOS/nixpkgs#219747 and NixOS/nixpkgs#275548
- Using it can give easier-to-read code like `all isNull list`
@SuperSandro2000
Copy link
Member Author

I've changed the PR to only remove it where it decreases readability. Especially !isNull is in my opinion the same category as stacking multiple with: you should not do that.

@SuperSandro2000 SuperSandro2000 changed the title treewide: remove deprecated isNull treewide: remove isNull where it decreases readability and code understanding Dec 20, 2023
@infinisil
Copy link
Member

Out of all the bad code written in Nixpkgs, this is very far down the list imo. I don't think it's worth doing this. Especially because people will just continue using it regardless. And while this could be automated, it's absolutely not worth the trouble. So really, let's just not worry about this.

infinisil added a commit to tweag/nix that referenced this pull request Dec 20, 2023
There's no good reason to deprecate it:
- For consistency reasons it should continue to exist, such that all
primitive types have a corresponding `builtins.is*` primop.
- There's no implementation cost to continuing to have this function
- It costs users time to try to migrate away from it, e.g.
  NixOS/nixpkgs#219747 and NixOS/nixpkgs#275548
- Using it can give easier-to-read code like `all isNull list`

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
@SuperSandro2000
Copy link
Member Author

So we no longer want to fix bad code because people could write new bad code?

@@ -61,7 +61,7 @@ let
runHook preConfigure

${./mix-configure-hook.sh}
${lib.optionalString (!isNull appConfigPath)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Especially expression like this one shouldn't go through review as they complicate the code a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants