-
Notifications
You must be signed in to change notification settings - Fork 1
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
Natural<T> from X #78
Comments
Well, the Positive<some FiniteInteger> reinterpretation idea is not great. It doesn't always give you a value of Self, so you have to make things unnecessarily generic and manage that. |
Perhaps natural integer suffixes could be modeled using Integer generic parameters. struct Natural<let LowerBound: Int, Value: BinaryInteger> { } |
Closed
I think less is more when it comes to these types. Meh. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I could use a (natural ≥ 1) and a (natural ≥ 2) guarantee to hoist preconditions in places like (#77). Positive<T> and Radix<T> seem like nice candidates. I thought of names like Natural1<T> and Natural2<T> but I want all trusted input types to be meaningful. You can express (natural ≥ 1) as Positive<some FiniteInteger>. All binary integers can be reinterpreted as a same-size finite integer, so it would be available in all contexts as an unsafe option (at a minimum).
The text was updated successfully, but these errors were encountered: