ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:121054] [Ruby master Bug#21139] Prism and parse.y parses `it = it` differently
@ 2025-02-14 17:30 tompng (tomoya ishida) via ruby-core
  2025-02-14 23:08 ` [ruby-core:121061] " matz (Yukihiro Matsumoto) via ruby-core
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: tompng (tomoya ishida) via ruby-core @ 2025-02-14 17:30 UTC (permalink / raw)
  To: ruby-core; +Cc: tompng (tomoya ishida)

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

----------------------------------------
Bug #21139: Prism and parse.y parses `it = it` differently
https://bugs.ruby-lang.org/issues/21139

* Author: tompng (tomoya ishida)
* Status: Assigned
* Assignee: prism
* ruby -v: ruby 3.5.0dev (2025-02-14T16:49:52Z master ee181d1bb7) +PRISM [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
~~~
# ruby --parser=parse.y -e "42.tap { it = it; p it }"
nil
# ruby --parser=prism -e "42.tap { it = it; p it }"
42
~~~




-- 
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] 6+ messages in thread

* [ruby-core:121061] [Ruby master Bug#21139] Prism and parse.y parses `it = it` differently
  2025-02-14 17:30 [ruby-core:121054] [Ruby master Bug#21139] Prism and parse.y parses `it = it` differently tompng (tomoya ishida) via ruby-core
@ 2025-02-14 23:08 ` matz (Yukihiro Matsumoto) via ruby-core
  2025-02-15  3:21 ` [ruby-core:121063] " nobu (Nobuyoshi Nakada) via ruby-core
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: matz (Yukihiro Matsumoto) via ruby-core @ 2025-02-14 23:08 UTC (permalink / raw)
  To: ruby-core; +Cc: matz (Yukihiro Matsumoto)

Issue #21139 has been updated by matz (Yukihiro Matsumoto).


Assignment to `it` should be prohibited in the long run. Temporarily, I vote for Prism behavior.

Matz.

By the way, how can I clear assignee of the issue on Redmine?

----------------------------------------
Bug #21139: Prism and parse.y parses `it = it` differently
https://bugs.ruby-lang.org/issues/21139#change-111974

* Author: tompng (tomoya ishida)
* Status: Assigned
* Assignee: prism
* ruby -v: ruby 3.5.0dev (2025-02-14T16:49:52Z master ee181d1bb7) +PRISM [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
~~~
# ruby --parser=parse.y -e "42.tap { it = it; p it }"
nil
# ruby --parser=prism -e "42.tap { it = it; p it }"
42
~~~




-- 
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] 6+ messages in thread

* [ruby-core:121063] [Ruby master Bug#21139] Prism and parse.y parses `it = it` differently
  2025-02-14 17:30 [ruby-core:121054] [Ruby master Bug#21139] Prism and parse.y parses `it = it` differently tompng (tomoya ishida) via ruby-core
  2025-02-14 23:08 ` [ruby-core:121061] " matz (Yukihiro Matsumoto) via ruby-core
@ 2025-02-15  3:21 ` nobu (Nobuyoshi Nakada) via ruby-core
  2025-03-08 22:08 ` [ruby-core:121270] " alanwu (Alan Wu) via ruby-core
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2025-02-15  3:21 UTC (permalink / raw)
  To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)

Issue #21139 has been updated by nobu (Nobuyoshi Nakada).


matz (Yukihiro Matsumoto) wrote in #note-1:
> Assignment to `it` should be prohibited in the long run. Temporarily, I vote for Prism behavior.

1. Currently, `it` is an ordinary local variable if assigned syntactically.
2. And a local variable is `nil` before assigned, even in its RHS, at the runtime.

The behavior in parse.y obeys above principles.

Do you want to change the rule 1, make `it` always special?

----------------------------------------
Bug #21139: Prism and parse.y parses `it = it` differently
https://bugs.ruby-lang.org/issues/21139#change-111976

* Author: tompng (tomoya ishida)
* Status: Assigned
* Assignee: prism
* ruby -v: ruby 3.5.0dev (2025-02-14T16:49:52Z master ee181d1bb7) +PRISM [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
~~~
# ruby --parser=parse.y -e "42.tap { it = it; p it }"
nil
# ruby --parser=prism -e "42.tap { it = it; p it }"
42
~~~




-- 
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] 6+ messages in thread

* [ruby-core:121270] [Ruby master Bug#21139] Prism and parse.y parses `it = it` differently
  2025-02-14 17:30 [ruby-core:121054] [Ruby master Bug#21139] Prism and parse.y parses `it = it` differently tompng (tomoya ishida) via ruby-core
  2025-02-14 23:08 ` [ruby-core:121061] " matz (Yukihiro Matsumoto) via ruby-core
  2025-02-15  3:21 ` [ruby-core:121063] " nobu (Nobuyoshi Nakada) via ruby-core
@ 2025-03-08 22:08 ` alanwu (Alan Wu) via ruby-core
  2025-03-13 12:11 ` [ruby-core:121338] " matz (Yukihiro Matsumoto) via ruby-core
  2025-03-13 13:51 ` [ruby-core:121343] " kddnewton (Kevin Newton) via ruby-core
  4 siblings, 0 replies; 6+ messages in thread
From: alanwu (Alan Wu) via ruby-core @ 2025-03-08 22:08 UTC (permalink / raw)
  To: ruby-core; +Cc: alanwu (Alan Wu)

Issue #21139 has been updated by alanwu (Alan Wu).

File clipboard-202503081702-idzz2.png added
Status changed from Assigned to Open
Assignee deleted (prism)

matz (Yukihiro Matsumoto) wrote in #note-1:
> By the way, how can I clear assignee of the issue on Redmine?

The null option in the menu is the very first one and is rendered with a tiny height to make it hard to mouse over. It's easier to pick it with arrow keys.
Maybe the UX could be improved by tweaking some settings? CC @hsbt 

![](clipboard-202503081702-idzz2.png)
 



----------------------------------------
Bug #21139: Prism and parse.y parses `it = it` differently
https://bugs.ruby-lang.org/issues/21139#change-112226

* Author: tompng (tomoya ishida)
* Status: Open
* ruby -v: ruby 3.5.0dev (2025-02-14T16:49:52Z master ee181d1bb7) +PRISM [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
~~~
# ruby --parser=parse.y -e "42.tap { it = it; p it }"
nil
# ruby --parser=prism -e "42.tap { it = it; p it }"
42
~~~


---Files--------------------------------
clipboard-202503081702-idzz2.png (22.6 KB)


-- 
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] 6+ messages in thread

* [ruby-core:121338] [Ruby master Bug#21139] Prism and parse.y parses `it = it` differently
  2025-02-14 17:30 [ruby-core:121054] [Ruby master Bug#21139] Prism and parse.y parses `it = it` differently tompng (tomoya ishida) via ruby-core
                   ` (2 preceding siblings ...)
  2025-03-08 22:08 ` [ruby-core:121270] " alanwu (Alan Wu) via ruby-core
@ 2025-03-13 12:11 ` matz (Yukihiro Matsumoto) via ruby-core
  2025-03-13 13:51 ` [ruby-core:121343] " kddnewton (Kevin Newton) via ruby-core
  4 siblings, 0 replies; 6+ messages in thread
From: matz (Yukihiro Matsumoto) via ruby-core @ 2025-03-13 12:11 UTC (permalink / raw)
  To: ruby-core; +Cc: matz (Yukihiro Matsumoto)

Issue #21139 has been updated by matz (Yukihiro Matsumoto).


I said I prefer Prism behavior to `parse.y`. But It was due to my misunderstanding. `it = it` should initialize the local variable named `it` and the value should be `nil`, just like other `x = x` assignment in Ruby.
In the future, all assignment to `it` could be prohibited, maybe.

Matz.


----------------------------------------
Bug #21139: Prism and parse.y parses `it = it` differently
https://bugs.ruby-lang.org/issues/21139#change-112308

* Author: tompng (tomoya ishida)
* Status: Open
* ruby -v: ruby 3.5.0dev (2025-02-14T16:49:52Z master ee181d1bb7) +PRISM [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
~~~
# ruby --parser=parse.y -e "42.tap { it = it; p it }"
nil
# ruby --parser=prism -e "42.tap { it = it; p it }"
42
~~~


---Files--------------------------------
clipboard-202503081702-idzz2.png (22.6 KB)


-- 
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] 6+ messages in thread

* [ruby-core:121343] [Ruby master Bug#21139] Prism and parse.y parses `it = it` differently
  2025-02-14 17:30 [ruby-core:121054] [Ruby master Bug#21139] Prism and parse.y parses `it = it` differently tompng (tomoya ishida) via ruby-core
                   ` (3 preceding siblings ...)
  2025-03-13 12:11 ` [ruby-core:121338] " matz (Yukihiro Matsumoto) via ruby-core
@ 2025-03-13 13:51 ` kddnewton (Kevin Newton) via ruby-core
  4 siblings, 0 replies; 6+ messages in thread
From: kddnewton (Kevin Newton) via ruby-core @ 2025-03-13 13:51 UTC (permalink / raw)
  To: ruby-core; +Cc: kddnewton (Kevin Newton)

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

Assignee set to prism

----------------------------------------
Bug #21139: Prism and parse.y parses `it = it` differently
https://bugs.ruby-lang.org/issues/21139#change-112315

* Author: tompng (tomoya ishida)
* Status: Open
* Assignee: prism
* ruby -v: ruby 3.5.0dev (2025-02-14T16:49:52Z master ee181d1bb7) +PRISM [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
~~~
# ruby --parser=parse.y -e "42.tap { it = it; p it }"
nil
# ruby --parser=prism -e "42.tap { it = it; p it }"
42
~~~


---Files--------------------------------
clipboard-202503081702-idzz2.png (22.6 KB)


-- 
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] 6+ messages in thread

end of thread, other threads:[~2025-03-13 13:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-14 17:30 [ruby-core:121054] [Ruby master Bug#21139] Prism and parse.y parses `it = it` differently tompng (tomoya ishida) via ruby-core
2025-02-14 23:08 ` [ruby-core:121061] " matz (Yukihiro Matsumoto) via ruby-core
2025-02-15  3:21 ` [ruby-core:121063] " nobu (Nobuyoshi Nakada) via ruby-core
2025-03-08 22:08 ` [ruby-core:121270] " alanwu (Alan Wu) via ruby-core
2025-03-13 12:11 ` [ruby-core:121338] " matz (Yukihiro Matsumoto) via ruby-core
2025-03-13 13:51 ` [ruby-core:121343] " kddnewton (Kevin Newton) 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).