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

Constraints on variadic pack arity, template phase arity and constant time query operations on packs #5093

Open
CJ-Johnson opened this issue Mar 9, 2025 · 0 comments
Labels
design idea An issue recording a specific language design idea that folks can potentially pick up. long term issue Issues expected to take over 90 days to resolve. Does not apply to PRs.

Comments

@CJ-Johnson
Copy link
Contributor

Doc: https://docs.google.com/document/d/1bAG5UHqMw7i8Yoyv1wiIhG2dNlu5vLgOYvWyttYLges/

In case we decide we want to expand on the current variadics design to support symbolic phase pack arity constraints, template phase artity, and constant time query operations on a pack, I'm creating this as a long-term issue so the doc doesn't get lost and is hopefully eventually picked up as a proposal.

class Array(T:! type, N:! u32) {
  fn Make(...[== N] each t: T) -> Self {
    return {
      // In order for this line to compile, the constraint above must be applied.
      // Without the constraint, the type checker would have no way of
      // knowing if the pack was the same size as the backing array.
      .backing_array = (... each t),
    };
  }

  // ...
}
@CJ-Johnson CJ-Johnson added long term issue Issues expected to take over 90 days to resolve. Does not apply to PRs. design idea An issue recording a specific language design idea that folks can potentially pick up. labels Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design idea An issue recording a specific language design idea that folks can potentially pick up. long term issue Issues expected to take over 90 days to resolve. Does not apply to PRs.
Projects
None yet
Development

No branches or pull requests

1 participant