ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:101475] [Ruby master Bug#17398] SyntaxError in endless method
@ 2020-12-16 19:52 zverok.offline
  2020-12-17  0:49 ` [ruby-core:101482] " mame
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: zverok.offline @ 2020-12-16 19:52 UTC (permalink / raw)
  To: ruby-core

Issue #17398 has been reported by zverok (Victor Shepelev).

----------------------------------------
Bug #17398: SyntaxError in endless method
https://bugs.ruby-lang.org/issues/17398

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
This works:
```ruby
def foo() = puts("bar")
```

This does not:
```ruby
def foo() = puts "bar"
#                ^ syntax error, unexpected string literal, expecting `do' or '{' or '('
```

Is this intentional or accidental? Not sure how it is reasoned.



-- 
https://bugs.ruby-lang.org/

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

* [ruby-core:101482] [Ruby master Bug#17398] SyntaxError in endless method
  2020-12-16 19:52 [ruby-core:101475] [Ruby master Bug#17398] SyntaxError in endless method zverok.offline
@ 2020-12-17  0:49 ` mame
  2020-12-17  9:39 ` [ruby-core:101495] " zverok.offline
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mame @ 2020-12-17  0:49 UTC (permalink / raw)
  To: ruby-core

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


The body of an endless method must be an expression (called "arg" in the syntax rules of parse.y). `puts("bar")` is an expression, but `puts "bar"` is a statement (called "command" in the syntax rules).

I think it could be a bit confusing, but I have no idea whether we can/should allow a statement as a body of an endless method.

----------------------------------------
Bug #17398: SyntaxError in endless method
https://bugs.ruby-lang.org/issues/17398#change-89261

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
This works:
```ruby
def foo() = puts("bar")
```

This does not:
```ruby
def foo() = puts "bar"
#                ^ syntax error, unexpected string literal, expecting `do' or '{' or '('
```

Is this intentional or accidental? Not sure how it is reasoned.



-- 
https://bugs.ruby-lang.org/

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

* [ruby-core:101495] [Ruby master Bug#17398] SyntaxError in endless method
  2020-12-16 19:52 [ruby-core:101475] [Ruby master Bug#17398] SyntaxError in endless method zverok.offline
  2020-12-17  0:49 ` [ruby-core:101482] " mame
@ 2020-12-17  9:39 ` zverok.offline
  2020-12-17 13:52 ` [ruby-core:101496] " eregontp
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: zverok.offline @ 2020-12-17  9:39 UTC (permalink / raw)
  To: ruby-core

Issue #17398 has been updated by zverok (Victor Shepelev).


@mame Hmm, haven't thought about it from this perspective... Can you please explain a bit? As far as I can see, in, say, assignment context it behaves like an expression:

```ruby
result = puts 'foo'
# prints "foo", result = nil
```
I am just trying to describe the behavior in full for the next installment of my [changelog](https://rubyreferences.github.io/rubychanges/) and this aspect is quite confusing for me... Though, it is not endless-method specific, as far as I can see:

```ruby
y = sin x # OK
y = 1 + sin x
#           ^ unexpected local variable or method, expecting `do' or '{' or '('
```
What's the "rule of thumb" to understand this better?

----------------------------------------
Bug #17398: SyntaxError in endless method
https://bugs.ruby-lang.org/issues/17398#change-89275

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
This works:
```ruby
def foo() = puts("bar")
```

This does not:
```ruby
def foo() = puts "bar"
#                ^ syntax error, unexpected string literal, expecting `do' or '{' or '('
```

Is this intentional or accidental? Not sure how it is reasoned.



-- 
https://bugs.ruby-lang.org/

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

* [ruby-core:101496] [Ruby master Bug#17398] SyntaxError in endless method
  2020-12-16 19:52 [ruby-core:101475] [Ruby master Bug#17398] SyntaxError in endless method zverok.offline
  2020-12-17  0:49 ` [ruby-core:101482] " mame
  2020-12-17  9:39 ` [ruby-core:101495] " zverok.offline
@ 2020-12-17 13:52 ` eregontp
  2020-12-17 16:16 ` [ruby-core:101498] " halostatue
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: eregontp @ 2020-12-17 13:52 UTC (permalink / raw)
  To: ruby-core

Issue #17398 has been updated by Eregon (Benoit Daloze).


Conceptually, according to the typical definition in computer science, both `puts("bar")` and `puts "bar"` are expressions (i.e., they return a value, and if it was some other method than `puts` it would also not always be `nil`).
It might be slightly less clear for e.g. `a = 42` (it's still an expression, it still returns a value), but I think `puts "bar"` is clear that it should be the same as `puts("bar")`, except for precedence.

So it's probably going to be very difficult to explain the actual condition, other than showing specific examples.

----------------------------------------
Bug #17398: SyntaxError in endless method
https://bugs.ruby-lang.org/issues/17398#change-89276

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
This works:
```ruby
def foo() = puts("bar")
```

This does not:
```ruby
def foo() = puts "bar"
#                ^ syntax error, unexpected string literal, expecting `do' or '{' or '('
```

Is this intentional or accidental? Not sure how it is reasoned.



-- 
https://bugs.ruby-lang.org/

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

* [ruby-core:101498] [Ruby master Bug#17398] SyntaxError in endless method
  2020-12-16 19:52 [ruby-core:101475] [Ruby master Bug#17398] SyntaxError in endless method zverok.offline
                   ` (2 preceding siblings ...)
  2020-12-17 13:52 ` [ruby-core:101496] " eregontp
@ 2020-12-17 16:16 ` halostatue
  2020-12-18  1:58 ` [ruby-core:101503] " mame
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: halostatue @ 2020-12-17 16:16 UTC (permalink / raw)
  To: ruby-core

Issue #17398 has been updated by austin (Austin Ziegler).


Eregon (Benoit Daloze) wrote in #note-3:
> So it's probably going to be very difficult to explain the actual condition, other than showing specific examples.

Endless methods definitions don’t support poetry mode?

----------------------------------------
Bug #17398: SyntaxError in endless method
https://bugs.ruby-lang.org/issues/17398#change-89278

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
This works:
```ruby
def foo() = puts("bar")
```

This does not:
```ruby
def foo() = puts "bar"
#                ^ syntax error, unexpected string literal, expecting `do' or '{' or '('
```

Is this intentional or accidental? Not sure how it is reasoned.



-- 
https://bugs.ruby-lang.org/

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

* [ruby-core:101503] [Ruby master Bug#17398] SyntaxError in endless method
  2020-12-16 19:52 [ruby-core:101475] [Ruby master Bug#17398] SyntaxError in endless method zverok.offline
                   ` (3 preceding siblings ...)
  2020-12-17 16:16 ` [ruby-core:101498] " halostatue
@ 2020-12-18  1:58 ` mame
  2021-04-16  4:30 ` [ruby-core:103470] [Ruby master Feature#17398] " matz
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mame @ 2020-12-18  1:58 UTC (permalink / raw)
  To: ruby-core

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


The following patch allows `def foo() = puts "bar"`. It brings no parser conflict.

https://gist.github.com/mame/0773bf3938e046e2b608de5fb2a826c8

However, it is not perfect. `private def foo() = puts "foo"` does not parse.
`private var = puts "bar"` is not allowed neither, so I have no idea how to allow this.

----------------------------------------
Bug #17398: SyntaxError in endless method
https://bugs.ruby-lang.org/issues/17398#change-89283

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
This works:
```ruby
def foo() = puts("bar")
```

This does not:
```ruby
def foo() = puts "bar"
#                ^ syntax error, unexpected string literal, expecting `do' or '{' or '('
```

Is this intentional or accidental? Not sure how it is reasoned.



-- 
https://bugs.ruby-lang.org/

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

* [ruby-core:103470] [Ruby master Feature#17398] SyntaxError in endless method
  2020-12-16 19:52 [ruby-core:101475] [Ruby master Bug#17398] SyntaxError in endless method zverok.offline
                   ` (4 preceding siblings ...)
  2020-12-18  1:58 ` [ruby-core:101503] " mame
@ 2021-04-16  4:30 ` matz
  2021-04-19  5:06 ` [ruby-core:103510] " mame
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: matz @ 2021-04-16  4:30 UTC (permalink / raw)
  To: ruby-core

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

Backport deleted (2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN)
Tracker changed from Bug to Feature

Pros
* More intuitive / consistent / natural
Cons
* Duplicated syntax rules
* Even more complex syntax

If I were young, I would add @mame's patch. I did similar decisions many times in the past. But Ruby has been mature and complex, I now feel reluctant. Let us consider this idea for a while.

Matz.


----------------------------------------
Feature #17398: SyntaxError in endless method
https://bugs.ruby-lang.org/issues/17398#change-91566

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
----------------------------------------
This works:
```ruby
def foo() = puts("bar")
```

This does not:
```ruby
def foo() = puts "bar"
#                ^ syntax error, unexpected string literal, expecting `do' or '{' or '('
```

Is this intentional or accidental? Not sure how it is reasoned.



-- 
https://bugs.ruby-lang.org/

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

* [ruby-core:103510] [Ruby master Feature#17398] SyntaxError in endless method
  2020-12-16 19:52 [ruby-core:101475] [Ruby master Bug#17398] SyntaxError in endless method zverok.offline
                   ` (5 preceding siblings ...)
  2021-04-16  4:30 ` [ruby-core:103470] [Ruby master Feature#17398] " matz
@ 2021-04-19  5:06 ` mame
  2021-05-12  8:32 ` [ruby-core:103795] " matz
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mame @ 2021-04-19  5:06 UTC (permalink / raw)
  To: ruby-core

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

File allow-command-style-endless-method-def.patch added

I'm attaching an updated patch with a test.

----------------------------------------
Feature #17398: SyntaxError in endless method
https://bugs.ruby-lang.org/issues/17398#change-91609

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
----------------------------------------
This works:
```ruby
def foo() = puts("bar")
```

This does not:
```ruby
def foo() = puts "bar"
#                ^ syntax error, unexpected string literal, expecting `do' or '{' or '('
```

Is this intentional or accidental? Not sure how it is reasoned.

---Files--------------------------------
allow-command-style-endless-method-def.patch (3.44 KB)


-- 
https://bugs.ruby-lang.org/

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

* [ruby-core:103795] [Ruby master Feature#17398] SyntaxError in endless method
  2020-12-16 19:52 [ruby-core:101475] [Ruby master Bug#17398] SyntaxError in endless method zverok.offline
                   ` (6 preceding siblings ...)
  2021-04-19  5:06 ` [ruby-core:103510] " mame
@ 2021-05-12  8:32 ` matz
  2025-09-01  3:50 ` [ruby-core:123152] [Ruby " yui-knk (Kaneko Yuichiro) via ruby-core
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: matz @ 2021-05-12  8:32 UTC (permalink / raw)
  To: ruby-core

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


I have considered this issue for a while and concluded it should be merged to be consistent with the assignment statement.

Matz.


----------------------------------------
Feature #17398: SyntaxError in endless method
https://bugs.ruby-lang.org/issues/17398#change-91910

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
----------------------------------------
This works:
```ruby
def foo() = puts("bar")
```

This does not:
```ruby
def foo() = puts "bar"
#                ^ syntax error, unexpected string literal, expecting `do' or '{' or '('
```

Is this intentional or accidental? Not sure how it is reasoned.

---Files--------------------------------
allow-command-style-endless-method-def.patch (3.44 KB)


-- 
https://bugs.ruby-lang.org/

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

* [ruby-core:123152] [Ruby Feature#17398] SyntaxError in endless method
  2020-12-16 19:52 [ruby-core:101475] [Ruby master Bug#17398] SyntaxError in endless method zverok.offline
                   ` (7 preceding siblings ...)
  2021-05-12  8:32 ` [ruby-core:103795] " matz
@ 2025-09-01  3:50 ` yui-knk (Kaneko Yuichiro) via ruby-core
  2025-09-01  3:56 ` [ruby-core:123153] " mame (Yusuke Endoh) via ruby-core
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: yui-knk (Kaneko Yuichiro) via ruby-core @ 2025-09-01  3:50 UTC (permalink / raw)
  To: ruby-core; +Cc: yui-knk (Kaneko Yuichiro)

Issue #17398 has been updated by yui-knk (Kaneko Yuichiro).


> Note that private def hello = puts "Hello" does not parse for technical reason.

It's possible.
Patch is https://github.com/yui-knk/ruby/tree/bug_17398.
This change allows single endless method definition with command body as an argument of the method.
Some cases you might be aware are

* `private :m, def hello = puts "Hello"`
  * This is SyntaxError because only single argument case is allowed.
  * This is same with one command is passed to argument. `obj.m 0, cmd 1, 2` is SyntaxError.
* `private def hello = puts "Hello", "World"`
  * This is interpreted as `private def hello = puts("Hello", "World")` not `private (def hello = puts "Hello"), "World"`.
  * This is same with one command is passed to argument. `obj.m cmd 1, 2` is interpreted as `obj.m cmd(1, 2)` not `obj.m (cmd 1), 2`.
* `private def hello = puts "Hello" do expr end`
  * This is interpreted as `private (def hello = puts "Hello") do expr end` not `private (def hello = puts "Hello" do expr end)`
  * This is same with one command is passed to argument. `obj.m cmd 1, 2 do expr end` is interpreted as `obj.m (cmd 1, 2) do expr end` not `obj.m (cmd 1, 2 do expr end)`

----------------------------------------
Feature #17398: SyntaxError in endless method
https://bugs.ruby-lang.org/issues/17398#change-114484

* Author: zverok (Victor Shepelev)
* Status: Closed
----------------------------------------
This works:
```ruby
def foo() = puts("bar")
```

This does not:
```ruby
def foo() = puts "bar"
#                ^ syntax error, unexpected string literal, expecting `do' or '{' or '('
```

Is this intentional or accidental? Not sure how it is reasoned.

---Files--------------------------------
allow-command-style-endless-method-def.patch (3.44 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] 15+ messages in thread

* [ruby-core:123153] [Ruby Feature#17398] SyntaxError in endless method
  2020-12-16 19:52 [ruby-core:101475] [Ruby master Bug#17398] SyntaxError in endless method zverok.offline
                   ` (8 preceding siblings ...)
  2025-09-01  3:50 ` [ruby-core:123152] [Ruby " yui-knk (Kaneko Yuichiro) via ruby-core
@ 2025-09-01  3:56 ` mame (Yusuke Endoh) via ruby-core
  2025-09-02  3:13 ` [ruby-core:123161] " matz (Yukihiro Matsumoto) via ruby-core
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mame (Yusuke Endoh) via ruby-core @ 2025-09-01  3:56 UTC (permalink / raw)
  To: ruby-core; +Cc: mame (Yusuke Endoh)

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

Status changed from Closed to Open

Thanks, it looks good. @matz what do you think?

----------------------------------------
Feature #17398: SyntaxError in endless method
https://bugs.ruby-lang.org/issues/17398#change-114485

* Author: zverok (Victor Shepelev)
* Status: Open
----------------------------------------
This works:
```ruby
def foo() = puts("bar")
```

This does not:
```ruby
def foo() = puts "bar"
#                ^ syntax error, unexpected string literal, expecting `do' or '{' or '('
```

Is this intentional or accidental? Not sure how it is reasoned.

---Files--------------------------------
allow-command-style-endless-method-def.patch (3.44 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] 15+ messages in thread

* [ruby-core:123161] [Ruby Feature#17398] SyntaxError in endless method
  2020-12-16 19:52 [ruby-core:101475] [Ruby master Bug#17398] SyntaxError in endless method zverok.offline
                   ` (9 preceding siblings ...)
  2025-09-01  3:56 ` [ruby-core:123153] " mame (Yusuke Endoh) via ruby-core
@ 2025-09-02  3:13 ` matz (Yukihiro Matsumoto) via ruby-core
  2025-09-02  3:22 ` [ruby-core:123162] " mame (Yusuke Endoh) via ruby-core
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: matz (Yukihiro Matsumoto) via ruby-core @ 2025-09-02  3:13 UTC (permalink / raw)
  To: ruby-core; +Cc: matz (Yukihiro Matsumoto)

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


Sounds reasonable, considering existing grammar.

Matz.


----------------------------------------
Feature #17398: SyntaxError in endless method
https://bugs.ruby-lang.org/issues/17398#change-114499

* Author: zverok (Victor Shepelev)
* Status: Open
----------------------------------------
This works:
```ruby
def foo() = puts("bar")
```

This does not:
```ruby
def foo() = puts "bar"
#                ^ syntax error, unexpected string literal, expecting `do' or '{' or '('
```

Is this intentional or accidental? Not sure how it is reasoned.

---Files--------------------------------
allow-command-style-endless-method-def.patch (3.44 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] 15+ messages in thread

* [ruby-core:123162] [Ruby Feature#17398] SyntaxError in endless method
  2020-12-16 19:52 [ruby-core:101475] [Ruby master Bug#17398] SyntaxError in endless method zverok.offline
                   ` (10 preceding siblings ...)
  2025-09-02  3:13 ` [ruby-core:123161] " matz (Yukihiro Matsumoto) via ruby-core
@ 2025-09-02  3:22 ` mame (Yusuke Endoh) via ruby-core
  2025-09-02 11:34 ` [ruby-core:123164] " Earlopain (Earlopain _) via ruby-core
  2025-09-12 19:03 ` [ruby-core:123234] " kddnewton (Kevin Newton) via ruby-core
  13 siblings, 0 replies; 15+ messages in thread
From: mame (Yusuke Endoh) via ruby-core @ 2025-09-02  3:22 UTC (permalink / raw)
  To: ruby-core; +Cc: mame (Yusuke Endoh)

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

Status changed from Open to Assigned
Assignee set to prism

Ok, then we need a patch for prism

----------------------------------------
Feature #17398: SyntaxError in endless method
https://bugs.ruby-lang.org/issues/17398#change-114500

* Author: zverok (Victor Shepelev)
* Status: Assigned
* Assignee: prism
----------------------------------------
This works:
```ruby
def foo() = puts("bar")
```

This does not:
```ruby
def foo() = puts "bar"
#                ^ syntax error, unexpected string literal, expecting `do' or '{' or '('
```

Is this intentional or accidental? Not sure how it is reasoned.

---Files--------------------------------
allow-command-style-endless-method-def.patch (3.44 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] 15+ messages in thread

* [ruby-core:123164] [Ruby Feature#17398] SyntaxError in endless method
  2020-12-16 19:52 [ruby-core:101475] [Ruby master Bug#17398] SyntaxError in endless method zverok.offline
                   ` (11 preceding siblings ...)
  2025-09-02  3:22 ` [ruby-core:123162] " mame (Yusuke Endoh) via ruby-core
@ 2025-09-02 11:34 ` Earlopain (Earlopain _) via ruby-core
  2025-09-12 19:03 ` [ruby-core:123234] " kddnewton (Kevin Newton) via ruby-core
  13 siblings, 0 replies; 15+ messages in thread
From: Earlopain (Earlopain _) via ruby-core @ 2025-09-02 11:34 UTC (permalink / raw)
  To: ruby-core; +Cc: Earlopain (Earlopain _)

Issue #17398 has been updated by Earlopain (Earlopain _).


It is easy for prism to accept this as well: https://github.com/ruby/prism/pull/3632

I checked the above examples and prism seems to interpret them in the same way.

----------------------------------------
Feature #17398: SyntaxError in endless method
https://bugs.ruby-lang.org/issues/17398#change-114503

* Author: zverok (Victor Shepelev)
* Status: Assigned
* Assignee: prism
----------------------------------------
This works:
```ruby
def foo() = puts("bar")
```

This does not:
```ruby
def foo() = puts "bar"
#                ^ syntax error, unexpected string literal, expecting `do' or '{' or '('
```

Is this intentional or accidental? Not sure how it is reasoned.

---Files--------------------------------
allow-command-style-endless-method-def.patch (3.44 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] 15+ messages in thread

* [ruby-core:123234] [Ruby Feature#17398] SyntaxError in endless method
  2020-12-16 19:52 [ruby-core:101475] [Ruby master Bug#17398] SyntaxError in endless method zverok.offline
                   ` (12 preceding siblings ...)
  2025-09-02 11:34 ` [ruby-core:123164] " Earlopain (Earlopain _) via ruby-core
@ 2025-09-12 19:03 ` kddnewton (Kevin Newton) via ruby-core
  13 siblings, 0 replies; 15+ messages in thread
From: kddnewton (Kevin Newton) via ruby-core @ 2025-09-12 19:03 UTC (permalink / raw)
  To: ruby-core; +Cc: kddnewton (Kevin Newton)

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

Status changed from Closed to Open
Assignee deleted (prism)

This is now fixed in prism, will need a fix for parse.y.

----------------------------------------
Feature #17398: SyntaxError in endless method
https://bugs.ruby-lang.org/issues/17398#change-114565

* Author: zverok (Victor Shepelev)
* Status: Open
----------------------------------------
This works:
```ruby
def foo() = puts("bar")
```

This does not:
```ruby
def foo() = puts "bar"
#                ^ syntax error, unexpected string literal, expecting `do' or '{' or '('
```

Is this intentional or accidental? Not sure how it is reasoned.

---Files--------------------------------
allow-command-style-endless-method-def.patch (3.44 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] 15+ messages in thread

end of thread, other threads:[~2025-09-12 19:04 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-16 19:52 [ruby-core:101475] [Ruby master Bug#17398] SyntaxError in endless method zverok.offline
2020-12-17  0:49 ` [ruby-core:101482] " mame
2020-12-17  9:39 ` [ruby-core:101495] " zverok.offline
2020-12-17 13:52 ` [ruby-core:101496] " eregontp
2020-12-17 16:16 ` [ruby-core:101498] " halostatue
2020-12-18  1:58 ` [ruby-core:101503] " mame
2021-04-16  4:30 ` [ruby-core:103470] [Ruby master Feature#17398] " matz
2021-04-19  5:06 ` [ruby-core:103510] " mame
2021-05-12  8:32 ` [ruby-core:103795] " matz
2025-09-01  3:50 ` [ruby-core:123152] [Ruby " yui-knk (Kaneko Yuichiro) via ruby-core
2025-09-01  3:56 ` [ruby-core:123153] " mame (Yusuke Endoh) via ruby-core
2025-09-02  3:13 ` [ruby-core:123161] " matz (Yukihiro Matsumoto) via ruby-core
2025-09-02  3:22 ` [ruby-core:123162] " mame (Yusuke Endoh) via ruby-core
2025-09-02 11:34 ` [ruby-core:123164] " Earlopain (Earlopain _) via ruby-core
2025-09-12 19:03 ` [ruby-core:123234] " 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).