Skip to content

[Feature] Parameterized array using const generics #28676

@mohammadfawaz

Description

@mohammadfawaz

🚀 Feature

We need to be able to write code like this:

program const_generics.aleo {
    transition main() -> u32 {
        return foo::[5]();
    }

    inline foo[N: u32](arr: [u32; N]) -> u32 {
        return N;
    }
}

Currently, we only allow literals as array sizes. We need to change that and then later const evaluate the sizes.

Metadata

Metadata

Assignees

Labels

featureA new feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions