
Issue #20785 has been updated by Eregon (Benoit Daloze). I think @Dan0042 has a point. For instance if I'm using some longer variables names and the array/tuple has many elements it would be natural to wrap it into two lines, but IIUC this change would break it: ```ruby if tuple in element_type, element_size, dimensions, pointer, offset, buffer_length, stride ... end # might be wrapped as: if tuple in element_type, element_size, dimensions, pointer, offset, buffer_length, stride ... end ``` In the OP description, I think all cases can be very easily made clear and unambiguous by appending `*`. For example: ```ruby tap do a in b, * and c a in b, * or c a in b, * rescue c end tap do a in b, * end tap do a in b, * rescue end ``` From that I *think* considering trailing comma for `in` pattern matching as SyntaxError is good, as it encourages clarity and removes syntactical ambiguity (at least from a human perception). ---------------------------------------- Bug #20785: Should `a in b, and c` `a in b, or c` `a in b, rescue c` be syntax ok? https://bugs.ruby-lang.org/issues/20785#change-110637 * Author: tompng (tomoya ishida) * Status: Assigned * Assignee: matz (Yukihiro Matsumoto) * ruby -v: ruby 3.4.0dev (2024-10-04T03:22:53Z master 939ec9f080) +YJIT +MN +PRISM [arm64-darwin22] * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- This code is accepted in parse.y but rejected in prism ~~~ruby tap do a in b, and c a in b, or c a in b, rescue c end # parsed as tap do (a in b,;) and c (a in b,;) or c a in b,; rescue c end ~~~ I think these should be rejected like prism (parse.y accepts) ~~~ruby a in b, and c a in b, and c tap do a in b, rescue c end ~~~ I think these should be accepted like parse.y (prism rejects) ~~~ruby tap do a in b, end tap do a in b, rescue end ~~~ -- https://bugs.ruby-lang.org/