-
Notifications
You must be signed in to change notification settings - Fork 3
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
Between Numeric and BinaryInteger #93
Comments
I'd also like to avoid making it integer specific, because that would make the un/signed integer protocols confusing (as they are binary). |
Hm. Most of the Signed<Magnitude> things I want to generalize are integer things, so I guess it would have to be integer related. Maybe I could call it something like basic or primitive since the un/signed protocols have established that binary is the default. |
There are some annoying things that come with trying to insert non-leaf protocols. Like, you get ambiguities if you try to customize existing BinaryInteger methods. It can be solved with additional overloads, however: extension String {
init(_ source: some NBKPlainInteger, radix: Int = 10, uppercase: Bool = false) { ... }
init(_ source: some NBKPlainInteger & BinaryInteger, radix: Int = 10, uppercase: Bool = false) { ... }
} |
I'd like to have a protocol that encompasses Signed<Magnitude> without shoehorning it down the binary integer protocol hierarchy. I imagine something like a numeric-but-divisible-and-convertible-thing-y. I haven't thought of the requirements yet, this is more like a todo-note.
The text was updated successfully, but these errors were encountered: