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

rework array formatting #3289

Closed
ghost opened this issue Oct 25, 2023 · 0 comments · Fixed by #3486
Closed

rework array formatting #3289

ghost opened this issue Oct 25, 2023 · 0 comments · Fixed by #3486
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Oct 25, 2023

Problem

The current method of array formatting in the Noir programming language appears somewhat ungainly and hard to read. Adopt a formatting approach inspired by the Swift programming language. Specifically, it is proposed to remove unnecessary spaces while keeping the positioning of the elements intact.

Happy Case

original:

func main() {
  [
    0 - 1 as u56, 0 - 1 as u56, 0 - 1 as u56, 0 - 1 as u56, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 0,
  ]
}

noirfmt:

fn main() {
    [0 - 1 as u56,
        0 - 1 as u56,
        0 - 1 as u56,
        0 - 1 as u56,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0];
}

swift:

func main() {
  [
    0 - 1 as u56, 0 - 1 as u56, 0 - 1 as u56, 0 - 1 as u56, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 0,
  ]
}

Alternatives Considered

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@ghost ghost added the enhancement New feature or request label Oct 25, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Oct 25, 2023
@ghost ghost mentioned this issue Nov 14, 2023
5 tasks
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Nov 15, 2023
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
Archived in project
Development

Successfully merging a pull request may close this issue.

0 participants