-
Notifications
You must be signed in to change notification settings - Fork 10
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
Dealing with the (temporary) lack of constant computations in const generics #5
Comments
Hi every one. I think we can use this issue as a traking issue for rust const generic evolution, official rust tracking issue. Since rust 1.59 we can now set a default value for const generic type, so we can define default About @rob-p question I made some test with nightly build it's work but I think it's not a good idea to use it. I think it's not a good idea to switch to nightly because it would limit the usage of the crate. The default values are already a big step forward in terms of readability/usability of the API. I think that the miraculous solution could be the use of macro to generate an automatic custom type for the user. Some thing like:
|
Thanks for the thoughts @natir! I also agree that requiring nightly is not a good idea. I'd like to be able to use this crate on stable, and I think most users live there as well. I like your macro idea to easily create the relevant k-mer type. The other big feature I'd like to figure out is how to specialize the reverse complement for the different configurations we offer. In particular, the hack that I have now only works when the underlying storage type is The question, of course, is how to specialize the implementation on the storage type |
For a real specialization it seems that we are in the same situation as for the constant generic (it may happen one day) track issue I'm thinking if we want to have a |
So, it turns out that currently (as of rust v1.51) with MVP const generics, we are not allowed to do simple computations with generic parameters. For example, it would be desirable to have something like this to automatically compute the size of the storage array we want to use based on the value of
K
provided to the class. However, such a capability is gated behind a feature flag on the nightly branch of rustc. We should determine how we want to handle this from a design perspective. I see a few options:I'd appreciate others' thoughts on this.
The text was updated successfully, but these errors were encountered: