Skip to content
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

Introduce common trait which any typenum type implements #153

Open
katyo opened this issue Jul 10, 2020 · 1 comment
Open

Introduce common trait which any typenum type implements #153

katyo opened this issue Jul 10, 2020 · 1 comment

Comments

@katyo
Copy link

katyo commented Jul 10, 2020

In some cases we need type-level numeric parameters which can be both signed and unsigned.
As I see currently corresponding trait is missing in typenum. This would like to be pretty helpful.

I see two ways to implement it:

  1. Rename Integer trait to Signed.
    Add new Integer trait which implemented for both Unsigned and Signed. Pros: Clear meaningful trait names. Cons: Breaking API changes.
  2. Add new Number trait which implemented for both Unsigned and Signed. Pros: Non-breaking API changes. Cons: Less meaninful trait name.

Can anybody suggest more clear trait name for second solution?

@Qqwy
Copy link

Qqwy commented Jul 21, 2022

The name Integral is used in some contexts as a more general name for "anything integer-like".

As an example, in Haskell, Natural is used for arbitrary-precision unsigned, Integer for arbitrary-precision signed, Word for 32/64-bit unsigned, Int for 32/64-bit signed, and Integral for the trait that they all have in common.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants