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 use custom's const field to declare symbolic size #195

Closed
wants to merge 2 commits into from

Conversation

katat
Copy link
Collaborator

@katat katat commented Sep 26, 2024

This makes it able to declare methods to return array using the struct's field as its symbolic size.

For example:

fn Thing.to_array(self) -> [Field; self.cst] {
    return [1; self.cst];
}

Changes

  1. Refactored the constant propagation to allow propagating multiple constants, such as array and custom type, in addition to single constant.
  2. Allow propagating constant values from native function/method.

I also create an issue to propose supporting const attribute for custom fields for better type checking. So it can type check self.cst for [Field; self.cst] where the symbolic size has to be constant.

@mimoo
Copy link
Contributor

mimoo commented Oct 5, 2024

as discussed privately I don't think we should go this route :o

@katat
Copy link
Collaborator Author

katat commented Oct 14, 2024

agreed, closing this.

@katat katat closed this Oct 14, 2024
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

Successfully merging this pull request may close these issues.

2 participants