Skip to content

Slight clean up the constructors for Hash#13704

Merged
Ericson2314 merged 1 commit intoNixOS:masterfrom
obsidiansystems:slight-hash-cleanup
Aug 7, 2025
Merged

Slight clean up the constructors for Hash#13704
Ericson2314 merged 1 commit intoNixOS:masterfrom
obsidiansystems:slight-hash-cleanup

Conversation

@Ericson2314
Copy link
Copy Markdown
Member

  • No more private constructor that is kinda weird

  • Two new static functions, baseFromSize and baseFromSize, that do one thing, and one thing only (simple).

  • Two Hash::parse* that previously used the private constructor now can use these two functions directly.

  • The remaining Hash::parseAny* methods, which are inherently more complex, are written in terms of a parseAnyHelper static function which is also complex, but keeps the complexity in one spot.

Motivation

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@Ericson2314 Ericson2314 requested a review from edolstra as a code owner August 6, 2025 23:40
@Ericson2314 Ericson2314 force-pushed the slight-hash-cleanup branch from 27732a1 to 000a827 Compare August 6, 2025 23:47
- No more private constructor that is kinda weird

- Two new static functions, `baseFromSize` and `baseFromSize`, that do
  one thing, and one thing only (simple).

- Two `Hash::parse*` that previously used the private constructor now
  can use these two functions directly.

- The remaining `Hash::parseAny*` methods, which are inherently more
  complex, are written in terms of a `parseAnyHelper` static function
  which is also complex, but keeps the complexity in one spot.
@Ericson2314 Ericson2314 force-pushed the slight-hash-cleanup branch from 000a827 to 9d8d8df Compare August 7, 2025 00:05
Copy link
Copy Markdown
Contributor

@xokdvium xokdvium left a comment

Choose a reason for hiding this comment

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

Can be iterated on in follow-ups

@Ericson2314 Ericson2314 merged commit 241420a into NixOS:master Aug 7, 2025
14 checks passed
@Ericson2314 Ericson2314 deleted the slight-hash-cleanup branch August 7, 2025 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants