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

X=1,2;X does not error even though 2 is unused #57

Open
4 tasks
jkeiser opened this issue May 12, 2022 · 0 comments
Open
4 tasks

X=1,2;X does not error even though 2 is unused #57

jkeiser opened this issue May 12, 2022 · 0 comments

Comments

@jkeiser
Copy link
Member

jkeiser commented May 12, 2022

X=1,2;X will assign X=1 and then create a stream (),2, so the output of this is 1. X=(1,2) work as expected.

This should either assign both 1 and 2 to X, or forbid the construction altogether. X = 1,2, X = 1 , 2, and X = 1, 2 should do the same thing as X=1,2.

A few possible solutions:

  • The program could output (1,2)
  • It could be an error to assign inside a comma at the same precedence level (X=1,2 or X = 1, 2).
  • It could be an error to leave a value unused anywhere.
  • The program could return the stream 2,1 because there are 2 statements that return values. In this case, () cannot be a value. This might be a wonderful idea, but we still need something more targeted to tell the user that X=1,2 isn't doing what it looks like it should.
@jkeiser jkeiser changed the title X=1,2;X does not error even thought 2 is unused X=1,2;X does not error even though 2 is unused May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant