-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
require (x...,)
instead of (x...)
to make a tuple?
#24452
Comments
I'm in favor of requiring the comma, unless that would also make the comma required in call expressions. |
It wouldn't. |
I think this is a good idea |
I’m not sure why, but when I read (I also like the anology between function signatures and tuples so the extra comma in one case and not the other seems odd to me) Edit: sorry, fumbled the buttons. |
It would not bother me if |
This is a minor syntax corner case. A comma is required to construct a tuple from a single expression except for
(x...)
, which is equivalent to(x...,)
. There is even a special case for this in the parser.This doesn't matter so much, but there are cases where it would be nice to use parentheses just to affect the precedence of
x...
. For example,1 + xs...
doesn't work, because+
has higher precedence than...
. (AFAICT, this is to allow1:n...
to work, and:
has lower precedence than+
.) If we were fully consistent about requiring the comma to make a tuple, then1 + (xs...)
could be used to splat into general infix calls.Alternatively (or in addition), we could decide that
1:n...
is not important, and give...
higher precedence, which would better match other unary and postfix operators.The text was updated successfully, but these errors were encountered: