Split out a new Base from HashFormat#14721
Conversation
We have the machinery to make a more informative error, telling the user what format was actually encountered, and not just that it is not the format that was requested.
This allows for better separation of concerns, and will allow better modeling of some things.
| /** | ||
| * Get the encoding function for the given base encoding. | ||
| */ | ||
| decltype(base16::encode) * encodeForBase(Base base); | ||
|
|
||
| /** | ||
| * Get the decoding function for the given base encoding. | ||
| */ | ||
| decltype(base16::decode) * decodeForBase(Base base); | ||
|
|
There was a problem hiding this comment.
This really should just be a BaseDecoder singleton const class with just virtual methods. No reason to do this function pointer hackery
There was a problem hiding this comment.
That will make this PR bigger with something that's sort of orthogonal, but tbc I am happy to do it. Would you like it in a first commit, or a second commit (or a second PR)?
There was a problem hiding this comment.
In this PR is fine. As a follow-up commit would work, since we already have function pointer hackers now.
There was a problem hiding this comment.
OK will do. Also remember this depends on #14720 so we better do that one first.
Sorry but the motivation has to be stronger than "better separation of concerns" (what concerns? what things do we want to model better?). This isn't Haskell, we don't need to model everything in the type system. I can't really see how writing "Base encoding" doesn't feel like a correct term. We're not encoding a base here, we're encoding a hash. |
|
🎉 All dependencies have been resolved ! |
|
If we're not doing structured JSON formats for hash, that removes one of the immediate needs I had for this. Drafting, accordingly. |
Motivation
This allows for better separation of concerns, and will allow better modeling of some things.
Context
Depends on #14720
I am not sure whether the
*Displayfunctions, to preserve existing behavior, are worth it!Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.