Skip to content

feat: support static array syntax #1397

@DavePearce

Description

@DavePearce

In order to improve the overall look of code, it would be helpful to support a static array syntax. For example, something like this:

fn sum(xs [4]u16) -> (res u32) {
  res = xs[0] + xs[1] + xs[2] + xs[3]
}

This would then automatically expand out to something equivalent to this:

fn sum(xs_0 u16, xs_1 u16, xs_2 u16, xs_3 u16) -> (res u32) {
  res = xs_0 + xs_1 + xs_2 + xs_3
}

For now, we would restrict the indices to be constants only. Therefore, e.g. xs[y] would not be permitted, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions