-
Notifications
You must be signed in to change notification settings - Fork 248
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
Add const generics #1837
Comments
One issue with allowing To fix this there are a few options:
Each of these options come with their own fair share of difficulties which is why this feature isn't present yet in Noir. |
Noting that #2178 removes the concept of comptime |
Going to close this issue now that #5155 is merged. |
Problem
The type system treats generic arguments as a
NamedGeneric
irrespective of whether they're normal types or numerical constants.It would be great if you could explicitly declare generic types as
comptime
(analogous to rust's const generics) and be able to do something like the following:The
N
here would be treated as aConstant
instead of aNamedGeneric
and thus we'd be allowed to do operations over it.Happy Case
Make something like this work:
Alternatives Considered
Declare
N
as a global constant insteadAdditional Context
No response
Would you like to submit a PR for this Issue?
Maybe
Support Needs
I'm happy to help out if this is useful and not too difficult to implement.
The text was updated successfully, but these errors were encountered: