Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

parse list { } as list{} #690

Closed
bobzhang opened this issue Oct 18, 2022 · 3 comments
Closed

parse list { } as list{} #690

bobzhang opened this issue Oct 18, 2022 · 3 comments

Comments

@bobzhang
Copy link
Member

bobzhang commented Oct 18, 2022

For beginners, it is confusing that list{1,2}works while list {1,2} does not work, it is a whitespace sensitive language now.
I propose that we lex list\ws+{ as a token, so that we can parse both
cc @IwanKaramazow let me know what you think?

cc @butterunderflow

@butterunderflow
Copy link
Contributor

butterunderflow commented Oct 19, 2022

After some tries, simply lexing list\ws+{ as a token will make some regression. Expression like

switch list {
| true => 1
| false => 0
}

will not be successfully parsed anymore.

Actually, I think the current behavior of

switch list {
| true => 1
| false => 0
}

parsed with no issue but

switch list{
| true => 0
| false => 1
}

triggering a syntax error is also a little bit confusing.

@IwanKaramazow
Copy link
Contributor

Yes, this is not possible. There are too many nuances and error messages that would regress.

@bobzhang
Copy link
Member Author

indeed, we have to document list{ as a gotcha some where, I regert that I did not stand firm to use #{ as list instead, but now let's move on and accept it as is

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants