ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:119488] [Ruby master Bug#20790] Syntax acceptance of `*x = p rescue p 1` is different between parse.y and prism
@ 2024-10-09  3:53 tompng (tomoya ishida) via ruby-core
  2024-11-07 10:36 ` [ruby-core:119803] " mame (Yusuke Endoh) via ruby-core
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: tompng (tomoya ishida) via ruby-core @ 2024-10-09  3:53 UTC (permalink / raw)
  To: ruby-core; +Cc: tompng (tomoya ishida)

Issue #20790 has been reported by tompng (tomoya ishida).

----------------------------------------
Bug #20790: Syntax acceptance of `*x = p rescue p 1` is different between parse.y and prism
https://bugs.ruby-lang.org/issues/20790

* 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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:119803] [Ruby master Bug#20790] Syntax acceptance of `*x = p rescue p 1` is different between parse.y and prism
  2024-10-09  3:53 [ruby-core:119488] [Ruby master Bug#20790] Syntax acceptance of `*x = p rescue p 1` is different between parse.y and prism tompng (tomoya ishida) via ruby-core
@ 2024-11-07 10:36 ` mame (Yusuke Endoh) via ruby-core
  2024-11-08 15:45 ` [ruby-core:119845] " kddnewton (Kevin Newton) via ruby-core
  2024-11-25 10:58 ` [ruby-core:120001] " ydah (Yudai Takada) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: mame (Yusuke Endoh) via ruby-core @ 2024-11-07 10:36 UTC (permalink / raw)
  To: ruby-core; +Cc: mame (Yusuke Endoh)

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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:119845] [Ruby master Bug#20790] Syntax acceptance of `*x = p rescue p 1` is different between parse.y and prism
  2024-10-09  3:53 [ruby-core:119488] [Ruby master Bug#20790] Syntax acceptance of `*x = p rescue p 1` is different between parse.y and prism tompng (tomoya ishida) via ruby-core
  2024-11-07 10:36 ` [ruby-core:119803] " mame (Yusuke Endoh) via ruby-core
@ 2024-11-08 15:45 ` kddnewton (Kevin Newton) via ruby-core
  2024-11-25 10:58 ` [ruby-core:120001] " ydah (Yudai Takada) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: kddnewton (Kevin Newton) via ruby-core @ 2024-11-08 15:45 UTC (permalink / raw)
  To: ruby-core; +Cc: kddnewton (Kevin Newton)

Issue #20790 has been updated by kddnewton (Kevin Newton).


That makes sense to me, we can make that work.

----------------------------------------
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-110535

* 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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:120001] [Ruby master Bug#20790] Syntax acceptance of `*x = p rescue p 1` is different between parse.y and prism
  2024-10-09  3:53 [ruby-core:119488] [Ruby master Bug#20790] Syntax acceptance of `*x = p rescue p 1` is different between parse.y and prism tompng (tomoya ishida) via ruby-core
  2024-11-07 10:36 ` [ruby-core:119803] " mame (Yusuke Endoh) via ruby-core
  2024-11-08 15:45 ` [ruby-core:119845] " kddnewton (Kevin Newton) via ruby-core
@ 2024-11-25 10:58 ` ydah (Yudai Takada) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: ydah (Yudai Takada) via ruby-core @ 2024-11-25 10:58 UTC (permalink / raw)
  To: ruby-core; +Cc: ydah (Yudai Takada)

Issue #20790 has been updated by ydah (Yudai Takada).


I checked if it is feasible with parse.y: https://github.com/ydah/ruby/commit/50100c136ac4bbe379b2c360994b739227610e17

I have been able to confirm that the following are feasible with the modifications shown above.

```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 1 rescue p 1  # x = ((p 1) rescue (p 1))   # as is
```

The following are still under investigation for feasibility.

```ruby
                    # current parse.y behavior   # matz's preference
x = p rescue p 1    # x = (p rescue p) 1 (ERROR) # x = (p rescue p 1)
```

----------------------------------------
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-110745

* 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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-11-25 10:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-09  3:53 [ruby-core:119488] [Ruby master Bug#20790] Syntax acceptance of `*x = p rescue p 1` is different between parse.y and prism tompng (tomoya ishida) via ruby-core
2024-11-07 10:36 ` [ruby-core:119803] " mame (Yusuke Endoh) via ruby-core
2024-11-08 15:45 ` [ruby-core:119845] " kddnewton (Kevin Newton) via ruby-core
2024-11-25 10:58 ` [ruby-core:120001] " ydah (Yudai Takada) via ruby-core

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).