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

Using range expression in foreach statement should not create a list #170

Closed
giann opened this issue Sep 6, 2023 · 0 comments
Closed

Using range expression in foreach statement should not create a list #170

giann opened this issue Sep 6, 2023 · 0 comments
Labels
language Issue related to the language
Milestone

Comments

@giann
Copy link
Collaborator

giann commented Sep 6, 2023

Ranges are syntaxic sugar to create list of integers.
But when used in a foreach statement it should be expanded to a classic for statement:

foreach (int i in 0...n) {
    | ...
}

should be syntaxic sugar for:

for (int i = 0; i < n; i = i + 1) {
    | ...
}
@giann giann added the language Issue related to the language label Sep 6, 2023
@giann giann added this to the 0.4.0 milestone Sep 6, 2023
giann added a commit that referenced this issue Mar 13, 2024
Range are now a special value that can be transformed into an [int] with toList.
This allows to use them in a foreach statement without instanciating a list.

closes #170
giann added a commit that referenced this issue Mar 13, 2024
Range are now a special value that can be transformed into an [int] with toList.
This allows to use them in a foreach statement without instanciating a list.

closes #170
@giann giann closed this as completed in 3497e6c Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language Issue related to the language
Projects
None yet
Development

No branches or pull requests

1 participant