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

Use typenum for type-level integers #1

Open
RustyYato opened this issue Jun 16, 2020 · 1 comment
Open

Use typenum for type-level integers #1

RustyYato opened this issue Jun 16, 2020 · 1 comment

Comments

@RustyYato
Copy link

Currently this crate uses peano arithmetic, but this is too inefficient in many cases (especially as numbers grow in size). It would be better to use typenum which offers all arithmetic operations in O(log(n)) time as the default. (I think we still need to keep the peano arithmetic because there are cases where it is more efficient, for example when counting things).

https://github.com/paholg/typenum

@willcrichton
Copy link
Owner

willcrichton commented Jun 17, 2020

Copying from my /r/rust comment:

The Peano numerals are just to test out the internal consistency of the system. The only barrier to using typenum would be the trait vs. type alias convention. The compiler assumes that any function call F(X, Y) can compile into F<X, Y> along with the bound X: ComputeF<Y>. So either you could write a Tyrade-friendly wrapper API for typenum, or add a typenum extension to the compiler.

Someone just needs to do that part, and we can integrate it.

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

No branches or pull requests

2 participants