ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:124367] [Ruby Bug#21808] Inconsistency in support of additional newlines with boolean logical operators on new line
@ 2025-12-26  6:16 herwin (Herwin W) via ruby-core
  2025-12-26  6:47 ` [ruby-core:124368] " mame (Yusuke Endoh) via ruby-core
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: herwin (Herwin W) via ruby-core @ 2025-12-26  6:16 UTC (permalink / raw)
  To: ruby-core; +Cc: herwin (Herwin W)

Issue #21808 has been reported by herwin (Herwin W).

----------------------------------------
Bug #21808: Inconsistency in support of additional newlines with boolean logical operators on new line
https://bugs.ruby-lang.org/issues/21808

* Author: herwin (Herwin W)
* Status: Open
* ruby -v: ruby 4.0.0 (2025-12-25 revision 553f1675f3) +PRISM [x86_64-linux]
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN
----------------------------------------
With this I mean the new Ruby 4 feature.

With the old style, one could add additional lines in between:
```ruby
if true &&

   true
     puts 'match'
end
```
With the new style, this results in a syntax error
```ruby
if true

   && true
     puts 'match'
end
```
If a comment is used instead of a new line, it still works
```ruby
if true
   # blah
   && true
     puts 'match'
end
```
This happens with both prism and parse.y

I doubt anyone would want to write code like this (I don't think it improves the layout), but it's still a weird inconsistency that doesn't get mentioned.



-- 
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:124368] [Ruby Bug#21808] Inconsistency in support of additional newlines with boolean logical operators on new line
  2025-12-26  6:16 [ruby-core:124367] [Ruby Bug#21808] Inconsistency in support of additional newlines with boolean logical operators on new line herwin (Herwin W) via ruby-core
@ 2025-12-26  6:47 ` mame (Yusuke Endoh) via ruby-core
  2025-12-27  8:38 ` [ruby-core:124371] " nobu (Nobuyoshi Nakada) via ruby-core
  2026-02-12  7:38 ` [ruby-core:124780] " matz (Yukihiro Matsumoto) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: mame (Yusuke Endoh) via ruby-core @ 2025-12-26  6:47 UTC (permalink / raw)
  To: ruby-core; +Cc: mame (Yusuke Endoh)

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

Status changed from Open to Assigned
Assignee set to matz (Yukihiro Matsumoto)

If I recall, this is intentional. A blank line before a period for a method call also causes a parsing error.

```
$ ruby -e '"foo"
>
> .upcase'
-e: -e:3: syntax error found (SyntaxError)
  1 | "foo"
  2 |
> 3 | .upcase
    | ^ unexpected '.', ignoring it
```

That said, I personally agree that it looks inconsistent. I'd like to confirm this with Matz.

----------------------------------------
Bug #21808: Inconsistency in support of additional newlines with boolean logical operators on new line
https://bugs.ruby-lang.org/issues/21808#change-115878

* Author: herwin (Herwin W)
* Status: Assigned
* Assignee: matz (Yukihiro Matsumoto)
* ruby -v: ruby 4.0.0 (2025-12-25 revision 553f1675f3) +PRISM [x86_64-linux]
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN
----------------------------------------
With this I mean the new Ruby 4 feature.

With the old style, one could add additional lines in between:
```ruby
if true &&

   true
     puts 'match'
end
```
With the new style, this results in a syntax error
```ruby
if true

   && true
     puts 'match'
end
```
If a comment is used instead of a new line, it still works
```ruby
if true
   # blah
   && true
     puts 'match'
end
```
This happens with both prism and parse.y

I doubt anyone would want to write code like this (I don't think it improves the layout), but it's still a weird inconsistency that doesn't get mentioned.



-- 
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:124371] [Ruby Bug#21808] Inconsistency in support of additional newlines with boolean logical operators on new line
  2025-12-26  6:16 [ruby-core:124367] [Ruby Bug#21808] Inconsistency in support of additional newlines with boolean logical operators on new line herwin (Herwin W) via ruby-core
  2025-12-26  6:47 ` [ruby-core:124368] " mame (Yusuke Endoh) via ruby-core
@ 2025-12-27  8:38 ` nobu (Nobuyoshi Nakada) via ruby-core
  2026-02-12  7:38 ` [ruby-core:124780] " matz (Yukihiro Matsumoto) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2025-12-27  8:38 UTC (permalink / raw)
  To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)

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

Backport changed from 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN to 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONTNEED, 4.0: UNKNOWN

That blank line separates code visually, so continuing beyond it doesn't look nice to me.

----------------------------------------
Bug #21808: Inconsistency in support of additional newlines with boolean logical operators on new line
https://bugs.ruby-lang.org/issues/21808#change-115884

* Author: herwin (Herwin W)
* Status: Assigned
* Assignee: matz (Yukihiro Matsumoto)
* ruby -v: ruby 4.0.0 (2025-12-25 revision 553f1675f3) +PRISM [x86_64-linux]
* Backport: 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONTNEED, 4.0: UNKNOWN
----------------------------------------
With this I mean the new Ruby 4 feature.

With the old style, one could add additional lines in between:
```ruby
if true &&

   true
     puts 'match'
end
```
With the new style, this results in a syntax error
```ruby
if true

   && true
     puts 'match'
end
```
If a comment is used instead of a new line, it still works
```ruby
if true
   # blah
   && true
     puts 'match'
end
```
This happens with both prism and parse.y

I doubt anyone would want to write code like this (I don't think it improves the layout), but it's still a weird inconsistency that doesn't get mentioned.



-- 
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:124780] [Ruby Bug#21808] Inconsistency in support of additional newlines with boolean logical operators on new line
  2025-12-26  6:16 [ruby-core:124367] [Ruby Bug#21808] Inconsistency in support of additional newlines with boolean logical operators on new line herwin (Herwin W) via ruby-core
  2025-12-26  6:47 ` [ruby-core:124368] " mame (Yusuke Endoh) via ruby-core
  2025-12-27  8:38 ` [ruby-core:124371] " nobu (Nobuyoshi Nakada) via ruby-core
@ 2026-02-12  7:38 ` matz (Yukihiro Matsumoto) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: matz (Yukihiro Matsumoto) via ruby-core @ 2026-02-12  7:38 UTC (permalink / raw)
  To: ruby-core; +Cc: matz (Yukihiro Matsumoto)

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


I agreed with @nobu here. Fluent method calls (`.`) behave same.

Matz.


----------------------------------------
Bug #21808: Inconsistency in support of additional newlines with boolean logical operators on new line
https://bugs.ruby-lang.org/issues/21808#change-116391

* Author: herwin (Herwin W)
* Status: Assigned
* Assignee: matz (Yukihiro Matsumoto)
* ruby -v: ruby 4.0.0 (2025-12-25 revision 553f1675f3) +PRISM [x86_64-linux]
* Backport: 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONTNEED, 4.0: UNKNOWN
----------------------------------------
With this I mean the new Ruby 4 feature.

With the old style, one could add additional lines in between:
```ruby
if true &&

   true
     puts 'match'
end
```
With the new style, this results in a syntax error
```ruby
if true

   && true
     puts 'match'
end
```
If a comment is used instead of a new line, it still works
```ruby
if true
   # blah
   && true
     puts 'match'
end
```
This happens with both prism and parse.y

I doubt anyone would want to write code like this (I don't think it improves the layout), but it's still a weird inconsistency that doesn't get mentioned.



-- 
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:[~2026-02-12  7:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-26  6:16 [ruby-core:124367] [Ruby Bug#21808] Inconsistency in support of additional newlines with boolean logical operators on new line herwin (Herwin W) via ruby-core
2025-12-26  6:47 ` [ruby-core:124368] " mame (Yusuke Endoh) via ruby-core
2025-12-27  8:38 ` [ruby-core:124371] " nobu (Nobuyoshi Nakada) via ruby-core
2026-02-12  7:38 ` [ruby-core:124780] " matz (Yukihiro Matsumoto) 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).