From: "mame (Yusuke Endoh) via ruby-core" Date: 2024-11-07T10:36:03+00:00 Subject: [ruby-core:119803] [Ruby master Bug#20790] Syntax acceptance of `*x = p rescue p 1` is different between parse.y and prism Issue #20790 has been updated by mame (Yusuke Endoh). Discussed at the dev meeting. Here is matz's preference. ```ruby # current parse.y behavior # matz's preference *x = p rescue p 1 # (*x = p) rescue (p 1) # *x = (p rescue (p 1)) *x = p 1 rescue p 1 # (*x = p 1) rescue (p 1) # *x = ((p 1) rescue (p 1)) a, b = p rescue p # a, b = (p rescue p) # as is x = p rescue p # x = (p rescue p) # as is x = p rescue p 1 # x = (p rescue p) 1 (ERROR) # x = (p rescue p 1) x = p 1 rescue p 1 # x = ((p 1) rescue (p 1)) # as is ``` @yui-knk @kddnewton What do you think? ---------------------------------------- Bug #20790: Syntax acceptance of `*x = p rescue p 1` is different between parse.y and prism https://bugs.ruby-lang.org/issues/20790#change-110487 * Author: tompng (tomoya ishida) * Status: Open * ruby -v: ruby 3.4.0dev (2024-10-09T03:27:05Z master ed11a244dd) +PRISM [x86_64-linux] * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- ~~~ruby *x = p rescue p 1 # syntax error in prism *x = p 1 rescue p 1 # both syntax ok x = p rescue p 1 # both syntax error x = p 1 rescue p 1 # both syntax ok ~~~ Which is correct? If `*x = p rescue p 1` is syntax valid, should `x = p rescue p 1` also be syntax valid? -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/