ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:120618] [Ruby master Bug#21029] Prism behavior for `defined? (;x)` differs
@ 2025-01-12  2:58 qnighy (Masaki Hara) via ruby-core
  2025-01-12 18:58 ` [ruby-core:120624] " kddnewton (Kevin Newton) via ruby-core
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: qnighy (Masaki Hara) via ruby-core @ 2025-01-12  2:58 UTC (permalink / raw)
  To: ruby-core; +Cc: qnighy (Masaki Hara)

Issue #21029 has been reported by qnighy (Masaki Hara).

----------------------------------------
Bug #21029: Prism behavior for `defined? (;x)` differs
https://bugs.ruby-lang.org/issues/21029

* Author: qnighy (Masaki Hara)
* Status: Open
* ruby -v: ruby 3.5.0dev (2025-01-11T03:21:57Z master 1b3037081e) +PRISM [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
Prism has a different behavior for `(;expr)` when used in `defined?` predicate:

```console
% ./miniruby --parser=prism -e "p defined? (;x)"
nil
% ./miniruby --parser=parse.y -e "p defined? (;x)"
"expression"
```

Although not a significant difference, aligning either of them with the other would be better.



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

* [ruby-core:120624] [Ruby master Bug#21029] Prism behavior for `defined? (;x)` differs
  2025-01-12  2:58 [ruby-core:120618] [Ruby master Bug#21029] Prism behavior for `defined? (;x)` differs qnighy (Masaki Hara) via ruby-core
@ 2025-01-12 18:58 ` kddnewton (Kevin Newton) via ruby-core
  2025-01-14 23:52 ` [ruby-core:120673] " kddnewton (Kevin Newton) via ruby-core
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kddnewton (Kevin Newton) via ruby-core @ 2025-01-12 18:58 UTC (permalink / raw)
  To: ruby-core; +Cc: kddnewton (Kevin Newton)

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

Assignee set to prism

----------------------------------------
Bug #21029: Prism behavior for `defined? (;x)` differs
https://bugs.ruby-lang.org/issues/21029#change-111454

* Author: qnighy (Masaki Hara)
* Status: Open
* Assignee: prism
* ruby -v: ruby 3.5.0dev (2025-01-11T03:21:57Z master 1b3037081e) +PRISM [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
Prism has a different behavior for `(;expr)` when used in `defined?` predicate:

```console
% ./miniruby --parser=prism -e "p defined? (;x)"
nil
% ./miniruby --parser=parse.y -e "p defined? (;x)"
"expression"
```

Although not a significant difference, aligning either of them with the other would be better.



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

* [ruby-core:120673] [Ruby master Bug#21029] Prism behavior for `defined? (;x)` differs
  2025-01-12  2:58 [ruby-core:120618] [Ruby master Bug#21029] Prism behavior for `defined? (;x)` differs qnighy (Masaki Hara) via ruby-core
  2025-01-12 18:58 ` [ruby-core:120624] " kddnewton (Kevin Newton) via ruby-core
@ 2025-01-14 23:52 ` kddnewton (Kevin Newton) via ruby-core
  2025-02-13  6:41 ` [ruby-core:120966] " matz (Yukihiro Matsumoto) via ruby-core
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kddnewton (Kevin Newton) via ruby-core @ 2025-01-14 23:52 UTC (permalink / raw)
  To: ruby-core; +Cc: kddnewton (Kevin Newton)

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


I think we should change `parse.y` to match this behavior. I will ask around.

----------------------------------------
Bug #21029: Prism behavior for `defined? (;x)` differs
https://bugs.ruby-lang.org/issues/21029#change-111497

* Author: qnighy (Masaki Hara)
* Status: Open
* Assignee: prism
* ruby -v: ruby 3.5.0dev (2025-01-11T03:21:57Z master 1b3037081e) +PRISM [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
Prism has a different behavior for `(;expr)` when used in `defined?` predicate:

```console
% ./miniruby --parser=prism -e "p defined? (;x)"
nil
% ./miniruby --parser=parse.y -e "p defined? (;x)"
"expression"
```

Although not a significant difference, aligning either of them with the other would be better.



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

* [ruby-core:120966] [Ruby master Bug#21029] Prism behavior for `defined? (;x)` differs
  2025-01-12  2:58 [ruby-core:120618] [Ruby master Bug#21029] Prism behavior for `defined? (;x)` differs qnighy (Masaki Hara) via ruby-core
  2025-01-12 18:58 ` [ruby-core:120624] " kddnewton (Kevin Newton) via ruby-core
  2025-01-14 23:52 ` [ruby-core:120673] " kddnewton (Kevin Newton) via ruby-core
@ 2025-02-13  6:41 ` matz (Yukihiro Matsumoto) via ruby-core
  2025-02-13  7:03 ` [ruby-core:120968] " qnighy (Masaki Hara) via ruby-core
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: matz (Yukihiro Matsumoto) via ruby-core @ 2025-02-13  6:41 UTC (permalink / raw)
  To: ruby-core; +Cc: matz (Yukihiro Matsumoto)

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


I think compound expressions (expressions (including empty) concatenated by semicolons) should be “expression” as `parse.y`.
It makes `defined?` simpler. I know the current `defined?` behavior recursively check for defined-ness (e.g., method parameters), I don't think we need that complexity here.

Matz.

----------------------------------------
Bug #21029: Prism behavior for `defined? (;x)` differs
https://bugs.ruby-lang.org/issues/21029#change-111865

* Author: qnighy (Masaki Hara)
* Status: Assigned
* Assignee: prism
* ruby -v: ruby 3.5.0dev (2025-01-11T03:21:57Z master 1b3037081e) +PRISM [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
Prism has a different behavior for `(;expr)` when used in `defined?` predicate:

```console
% ./miniruby --parser=prism -e "p defined? (;x)"
nil
% ./miniruby --parser=parse.y -e "p defined? (;x)"
"expression"
```

Although not a significant difference, aligning either of them with the other would be better.



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

* [ruby-core:120968] [Ruby master Bug#21029] Prism behavior for `defined? (;x)` differs
  2025-01-12  2:58 [ruby-core:120618] [Ruby master Bug#21029] Prism behavior for `defined? (;x)` differs qnighy (Masaki Hara) via ruby-core
                   ` (2 preceding siblings ...)
  2025-02-13  6:41 ` [ruby-core:120966] " matz (Yukihiro Matsumoto) via ruby-core
@ 2025-02-13  7:03 ` qnighy (Masaki Hara) via ruby-core
  2025-02-13 18:07 ` [ruby-core:120988] " kddnewton (Kevin Newton) via ruby-core
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: qnighy (Masaki Hara) via ruby-core @ 2025-02-13  7:03 UTC (permalink / raw)
  To: ruby-core; +Cc: qnighy (Masaki Hara)

Issue #21029 has been updated by qnighy (Masaki Hara).


> I think compound expressions (expressions (including empty) concatenated by semicolons) should be “expression” as `parse.y`.

Interestingly enough though:

```
% ruby --parser=prism -e "p defined? (x;)"
nil
% ruby --parser=parse.y -e "p defined? (x;)"
nil

% ruby --parser=prism -e "p defined? (;x)"
nil
% ruby --parser=parse.y -e "p defined? (;x)"
"expression"
```

----------------------------------------
Bug #21029: Prism behavior for `defined? (;x)` differs
https://bugs.ruby-lang.org/issues/21029#change-111867

* Author: qnighy (Masaki Hara)
* Status: Assigned
* Assignee: prism
* ruby -v: ruby 3.5.0dev (2025-01-11T03:21:57Z master 1b3037081e) +PRISM [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
Prism has a different behavior for `(;expr)` when used in `defined?` predicate:

```console
% ./miniruby --parser=prism -e "p defined? (;x)"
nil
% ./miniruby --parser=parse.y -e "p defined? (;x)"
"expression"
```

Although not a significant difference, aligning either of them with the other would be better.



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

* [ruby-core:120988] [Ruby master Bug#21029] Prism behavior for `defined? (;x)` differs
  2025-01-12  2:58 [ruby-core:120618] [Ruby master Bug#21029] Prism behavior for `defined? (;x)` differs qnighy (Masaki Hara) via ruby-core
                   ` (3 preceding siblings ...)
  2025-02-13  7:03 ` [ruby-core:120968] " qnighy (Masaki Hara) via ruby-core
@ 2025-02-13 18:07 ` kddnewton (Kevin Newton) via ruby-core
  2025-03-13 11:25 ` [ruby-core:121329] " mame (Yusuke Endoh) via ruby-core
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kddnewton (Kevin Newton) via ruby-core @ 2025-02-13 18:07 UTC (permalink / raw)
  To: ruby-core; +Cc: kddnewton (Kevin Newton)

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


@matz for what it's worth, it makes it much more complicated in the Prism compiler because we don't have empty statements. So it's not a recursive situation at the moment, it's just a single statement.

As @qnighy points out, should this be "expression" for when there is a trailing `;`?

----------------------------------------
Bug #21029: Prism behavior for `defined? (;x)` differs
https://bugs.ruby-lang.org/issues/21029#change-111892

* Author: qnighy (Masaki Hara)
* Status: Assigned
* Assignee: prism
* ruby -v: ruby 3.5.0dev (2025-01-11T03:21:57Z master 1b3037081e) +PRISM [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
Prism has a different behavior for `(;expr)` when used in `defined?` predicate:

```console
% ./miniruby --parser=prism -e "p defined? (;x)"
nil
% ./miniruby --parser=parse.y -e "p defined? (;x)"
"expression"
```

Although not a significant difference, aligning either of them with the other would be better.



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

* [ruby-core:121329] [Ruby master Bug#21029] Prism behavior for `defined? (;x)` differs
  2025-01-12  2:58 [ruby-core:120618] [Ruby master Bug#21029] Prism behavior for `defined? (;x)` differs qnighy (Masaki Hara) via ruby-core
                   ` (4 preceding siblings ...)
  2025-02-13 18:07 ` [ruby-core:120988] " kddnewton (Kevin Newton) via ruby-core
@ 2025-03-13 11:25 ` mame (Yusuke Endoh) via ruby-core
  2025-03-18 18:55 ` [ruby-core:121401] [Ruby " kddnewton (Kevin Newton) via ruby-core
  2025-03-18 18:55 ` [ruby-core:121402] " kddnewton (Kevin Newton) via ruby-core
  7 siblings, 0 replies; 9+ messages in thread
From: mame (Yusuke Endoh) via ruby-core @ 2025-03-13 11:25 UTC (permalink / raw)
  To: ruby-core; +Cc: mame (Yusuke Endoh)

Issue #21029 has been updated by mame (Yusuke Endoh).


Discussed at the dev meeting.

kddnewton (Kevin Newton) wrote in #note-6:
> As @qnighy points out, should this be "expression" for when there is a trailing `;`?

@matz said "yes"; `defined? (x;)` should also return `"expression"`.

----------------------------------------
Bug #21029: Prism behavior for `defined? (;x)` differs
https://bugs.ruby-lang.org/issues/21029#change-112296

* Author: qnighy (Masaki Hara)
* Status: Assigned
* Assignee: prism
* ruby -v: ruby 3.5.0dev (2025-01-11T03:21:57Z master 1b3037081e) +PRISM [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
Prism has a different behavior for `(;expr)` when used in `defined?` predicate:

```console
% ./miniruby --parser=prism -e "p defined? (;x)"
nil
% ./miniruby --parser=parse.y -e "p defined? (;x)"
"expression"
```

Although not a significant difference, aligning either of them with the other would be better.



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

* [ruby-core:121401] [Ruby Bug#21029] Prism behavior for `defined? (;x)` differs
  2025-01-12  2:58 [ruby-core:120618] [Ruby master Bug#21029] Prism behavior for `defined? (;x)` differs qnighy (Masaki Hara) via ruby-core
                   ` (5 preceding siblings ...)
  2025-03-13 11:25 ` [ruby-core:121329] " mame (Yusuke Endoh) via ruby-core
@ 2025-03-18 18:55 ` kddnewton (Kevin Newton) via ruby-core
  2025-03-18 18:55 ` [ruby-core:121402] " kddnewton (Kevin Newton) via ruby-core
  7 siblings, 0 replies; 9+ messages in thread
From: kddnewton (Kevin Newton) via ruby-core @ 2025-03-18 18:55 UTC (permalink / raw)
  To: ruby-core; +Cc: kddnewton (Kevin Newton)

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


I have updated Prism with https://github.com/ruby/ruby/commit/adaaa7878ebee62888bf3547d14c1db4938da88a, but the added test fails for `parse.y`. I haven't had a chance to look at it yet, but maybe someone else with more familiarity could.

----------------------------------------
Bug #21029: Prism behavior for `defined? (;x)` differs
https://bugs.ruby-lang.org/issues/21029#change-112376

* Author: qnighy (Masaki Hara)
* Status: Assigned
* Assignee: prism
* ruby -v: ruby 3.5.0dev (2025-01-11T03:21:57Z master 1b3037081e) +PRISM [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
Prism has a different behavior for `(;expr)` when used in `defined?` predicate:

```console
% ./miniruby --parser=prism -e "p defined? (;x)"
nil
% ./miniruby --parser=parse.y -e "p defined? (;x)"
"expression"
```

Although not a significant difference, aligning either of them with the other would be better.



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

* [ruby-core:121402] [Ruby Bug#21029] Prism behavior for `defined? (;x)` differs
  2025-01-12  2:58 [ruby-core:120618] [Ruby master Bug#21029] Prism behavior for `defined? (;x)` differs qnighy (Masaki Hara) via ruby-core
                   ` (6 preceding siblings ...)
  2025-03-18 18:55 ` [ruby-core:121401] [Ruby " kddnewton (Kevin Newton) via ruby-core
@ 2025-03-18 18:55 ` kddnewton (Kevin Newton) via ruby-core
  7 siblings, 0 replies; 9+ messages in thread
From: kddnewton (Kevin Newton) via ruby-core @ 2025-03-18 18:55 UTC (permalink / raw)
  To: ruby-core; +Cc: kddnewton (Kevin Newton)

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

Assignee deleted (prism)

----------------------------------------
Bug #21029: Prism behavior for `defined? (;x)` differs
https://bugs.ruby-lang.org/issues/21029#change-112377

* Author: qnighy (Masaki Hara)
* Status: Assigned
* ruby -v: ruby 3.5.0dev (2025-01-11T03:21:57Z master 1b3037081e) +PRISM [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
Prism has a different behavior for `(;expr)` when used in `defined?` predicate:

```console
% ./miniruby --parser=prism -e "p defined? (;x)"
nil
% ./miniruby --parser=parse.y -e "p defined? (;x)"
"expression"
```

Although not a significant difference, aligning either of them with the other would be better.



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

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

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-12  2:58 [ruby-core:120618] [Ruby master Bug#21029] Prism behavior for `defined? (;x)` differs qnighy (Masaki Hara) via ruby-core
2025-01-12 18:58 ` [ruby-core:120624] " kddnewton (Kevin Newton) via ruby-core
2025-01-14 23:52 ` [ruby-core:120673] " kddnewton (Kevin Newton) via ruby-core
2025-02-13  6:41 ` [ruby-core:120966] " matz (Yukihiro Matsumoto) via ruby-core
2025-02-13  7:03 ` [ruby-core:120968] " qnighy (Masaki Hara) via ruby-core
2025-02-13 18:07 ` [ruby-core:120988] " kddnewton (Kevin Newton) via ruby-core
2025-03-13 11:25 ` [ruby-core:121329] " mame (Yusuke Endoh) via ruby-core
2025-03-18 18:55 ` [ruby-core:121401] [Ruby " kddnewton (Kevin Newton) via ruby-core
2025-03-18 18:55 ` [ruby-core:121402] " 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).