-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Split out a new Base from HashFormat
#14721
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
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK will do. Also remember this depends on #14720 so we better do that one first.
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.
OK done
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.