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

Allow referencing numeric generics as values #972

Closed
jfecher opened this issue Mar 10, 2023 · 0 comments · Fixed by #997
Closed

Allow referencing numeric generics as values #972

jfecher opened this issue Mar 10, 2023 · 0 comments · Fixed by #997
Labels
enhancement New feature or request

Comments

@jfecher
Copy link
Contributor

jfecher commented Mar 10, 2023

Problem

Currently, given a function like

fn foo<N>(array: [Field; N]) -> Field {
    ...
}

Users would not be able to reference N directly as a value within foo since N is considered to be a type.

Proposed solution

Add N to the value scope as well and allow it to be referenced. During monomorphisation the value will be substituted with the numeric constant required by the caller as normal.

Alternatives considered

No response

Additional context

No response

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

Successfully merging a pull request may close this issue.

1 participant