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 trailing semicolon in list initializers #7

Closed
TheBerkin opened this issue Apr 13, 2021 · 0 comments
Closed

Allow trailing semicolon in list initializers #7

TheBerkin opened this issue Apr 13, 2021 · 0 comments
Labels
compiler Related to the Rant compiler enhancement New feature or request language Related to the Rant language

Comments

@TheBerkin
Copy link
Member

TheBerkin commented Apr 13, 2021

List initializers should allow a trailing semicolon at the end of the element list without automatically creating an empty at the end of the list.

Proposal

The following rules should apply when parsing semicolons in a list initializer context:

An empty list initializer with no semicolons produces an empty list

This is the current behavior, but it is worth noting that this should remain the case.

() # empty list

A semicolon only guarantees a value to its left

Even if there is nothing before the semicolon, it should signal to the compiler that there should be an empty element.

(;) # same as (~)

A final value with a terminating semicolon acts the same one without it

If a list ends with a value and no trailing semicolon, it should compile to the same list as one with the semicolon.

# 2-item list without trailing semi
(a; b) 
# Same 2-item list with trailing semi
(a; b;)
@TheBerkin TheBerkin created this issue from a note in Rant 4 Beta Roadmap (To do) Apr 13, 2021
@TheBerkin TheBerkin added compiler Related to the Rant compiler enhancement New feature or request language Related to the Rant language labels Apr 13, 2021
Rant 4 Beta Roadmap automation moved this from To do to Done Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler Related to the Rant compiler enhancement New feature or request language Related to the Rant language
Projects
Development

No branches or pull requests

1 participant