Actions
Bug #18883
closedparse.y: trailing comma cannot coexist with star
Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
Description
The following code is a syntax error:
*x, y, = 1, 2 # syntax error, unexpected '='
although the following:
x, y = 1, 2 # OK
x, y, = 1, 2 # OK
*x, y = 1, 2 # OK
# *x, y, = 1, 2
In my understanding, the trailing comma does nothing unless the lhs becomes otherwise a single assignment.
Therefore it is natural to allow the trailing comma whether *
exists or not.
Actions
Like0
Like0Like0Like0