* [ruby-core:105795] [Ruby master Bug#18267] Argument forwarding requires parenthesis on method definitions
@ 2021-10-25 23:52 tenderlovemaking (Aaron Patterson)
2021-10-26 8:36 ` [ruby-core:105803] " matz (Yukihiro Matsumoto)
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: tenderlovemaking (Aaron Patterson) @ 2021-10-25 23:52 UTC (permalink / raw)
To: ruby-core
Issue #18267 has been reported by tenderlovemaking (Aaron Patterson).
----------------------------------------
Bug #18267: Argument forwarding requires parenthesis on method definitions
https://bugs.ruby-lang.org/issues/18267
* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.0dev (2021-10-21T22:47:38Z master 844588f915) [x86_64-darwin20]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
I like to write my method definitions without parenthesis. For example:
```ruby
def foo bar
# ...
end
```
I tried to use `...`, but it doesn't work. For example if I do:
```ruby
def call a, ...
a.nil?(...)
end
```
It will be a syntax error, and the program exits. Can we make this syntax work so that I can always omit parenthesis?
Thank you!
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:105803] [Ruby master Bug#18267] Argument forwarding requires parenthesis on method definitions
2021-10-25 23:52 [ruby-core:105795] [Ruby master Bug#18267] Argument forwarding requires parenthesis on method definitions tenderlovemaking (Aaron Patterson)
@ 2021-10-26 8:36 ` matz (Yukihiro Matsumoto)
2021-10-26 18:50 ` [ruby-core:105813] " byroot (Jean Boussier)
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: matz (Yukihiro Matsumoto) @ 2021-10-26 8:36 UTC (permalink / raw)
To: ruby-core
Issue #18267 has been updated by matz (Yukihiro Matsumoto).
I agree that this is a bug.
Matz.
----------------------------------------
Bug #18267: Argument forwarding requires parenthesis on method definitions
https://bugs.ruby-lang.org/issues/18267#change-94321
* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.0dev (2021-10-21T22:47:38Z master 844588f915) [x86_64-darwin20]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
I like to write my method definitions without parenthesis. For example:
```ruby
def foo bar
# ...
end
```
I tried to use `...`, but it doesn't work. For example if I do:
```ruby
def call a, ...
a.nil?(...)
end
```
It will be a syntax error, and the program exits. Can we make this syntax work so that I can always omit parenthesis?
Thank you!
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:105813] [Ruby master Bug#18267] Argument forwarding requires parenthesis on method definitions
2021-10-25 23:52 [ruby-core:105795] [Ruby master Bug#18267] Argument forwarding requires parenthesis on method definitions tenderlovemaking (Aaron Patterson)
2021-10-26 8:36 ` [ruby-core:105803] " matz (Yukihiro Matsumoto)
@ 2021-10-26 18:50 ` byroot (Jean Boussier)
2021-10-26 19:03 ` [ruby-core:105814] " Eregon (Benoit Daloze)
2021-10-26 19:08 ` [ruby-core:105815] " Eregon (Benoit Daloze)
3 siblings, 0 replies; 5+ messages in thread
From: byroot (Jean Boussier) @ 2021-10-26 18:50 UTC (permalink / raw)
To: ruby-core
Issue #18267 has been updated by byroot (Jean Boussier).
It was known when the feature was introduced https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/d1ae2bc27fd4183e6abb9e83691e192bfe1e5316/diff, @mame added a NEWS entry specifically for it.
I presume it would clash with endless ranges?
----------------------------------------
Bug #18267: Argument forwarding requires parenthesis on method definitions
https://bugs.ruby-lang.org/issues/18267#change-94332
* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.0dev (2021-10-21T22:47:38Z master 844588f915) [x86_64-darwin20]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
I like to write my method definitions without parenthesis. For example:
```ruby
def foo bar
# ...
end
```
I tried to use `...`, but it doesn't work. For example if I do:
```ruby
def call a, ...
a.nil?(...)
end
```
It will be a syntax error, and the program exits. Can we make this syntax work so that I can always omit parenthesis?
Thank you!
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:105814] [Ruby master Bug#18267] Argument forwarding requires parenthesis on method definitions
2021-10-25 23:52 [ruby-core:105795] [Ruby master Bug#18267] Argument forwarding requires parenthesis on method definitions tenderlovemaking (Aaron Patterson)
2021-10-26 8:36 ` [ruby-core:105803] " matz (Yukihiro Matsumoto)
2021-10-26 18:50 ` [ruby-core:105813] " byroot (Jean Boussier)
@ 2021-10-26 19:03 ` Eregon (Benoit Daloze)
2021-10-26 19:08 ` [ruby-core:105815] " Eregon (Benoit Daloze)
3 siblings, 0 replies; 5+ messages in thread
From: Eregon (Benoit Daloze) @ 2021-10-26 19:03 UTC (permalink / raw)
To: ruby-core
Issue #18267 has been updated by Eregon (Benoit Daloze).
[joke] Maybe a reason to be a little bit more consistent about Ruby syntax and always use parens for method definitions? :D [/joke]
----------------------------------------
Bug #18267: Argument forwarding requires parenthesis on method definitions
https://bugs.ruby-lang.org/issues/18267#change-94333
* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.0dev (2021-10-21T22:47:38Z master 844588f915) [x86_64-darwin20]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
I like to write my method definitions without parenthesis. For example:
```ruby
def foo bar
# ...
end
```
I tried to use `...`, but it doesn't work. For example if I do:
```ruby
def call a, ...
a.nil?(...)
end
```
It will be a syntax error, and the program exits. Can we make this syntax work so that I can always omit parenthesis?
Thank you!
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:105815] [Ruby master Bug#18267] Argument forwarding requires parenthesis on method definitions
2021-10-25 23:52 [ruby-core:105795] [Ruby master Bug#18267] Argument forwarding requires parenthesis on method definitions tenderlovemaking (Aaron Patterson)
` (2 preceding siblings ...)
2021-10-26 19:03 ` [ruby-core:105814] " Eregon (Benoit Daloze)
@ 2021-10-26 19:08 ` Eregon (Benoit Daloze)
3 siblings, 0 replies; 5+ messages in thread
From: Eregon (Benoit Daloze) @ 2021-10-26 19:08 UTC (permalink / raw)
To: ruby-core
Issue #18267 has been updated by Eregon (Benoit Daloze).
On a more serious note, `def=` also has this restriction:
```
$ ruby -e 'def m(a) = 2'
OK
$ ruby -e 'def m a = 2'
-e:1: syntax error, unexpected end-of-input
$ ruby -e 'def m a = a'
-e:1: circular argument reference - a
-e:1: syntax error, unexpected end-of-input
```
Which I guess is trivially ambiguous because the `=` could be for an optional arg or for the method body.
Because `(...)` anyway needs parenthesis on call sites (ambiguous with endless ranges otherwise), I personally think it makes sense to also have parens as a parameter.
----------------------------------------
Bug #18267: Argument forwarding requires parenthesis on method definitions
https://bugs.ruby-lang.org/issues/18267#change-94334
* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.0dev (2021-10-21T22:47:38Z master 844588f915) [x86_64-darwin20]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
I like to write my method definitions without parenthesis. For example:
```ruby
def foo bar
# ...
end
```
I tried to use `...`, but it doesn't work. For example if I do:
```ruby
def call a, ...
a.nil?(...)
end
```
It will be a syntax error, and the program exits. Can we make this syntax work so that I can always omit parenthesis?
Thank you!
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-10-26 19:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-25 23:52 [ruby-core:105795] [Ruby master Bug#18267] Argument forwarding requires parenthesis on method definitions tenderlovemaking (Aaron Patterson)
2021-10-26 8:36 ` [ruby-core:105803] " matz (Yukihiro Matsumoto)
2021-10-26 18:50 ` [ruby-core:105813] " byroot (Jean Boussier)
2021-10-26 19:03 ` [ruby-core:105814] " Eregon (Benoit Daloze)
2021-10-26 19:08 ` [ruby-core:105815] " Eregon (Benoit Daloze)
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 read-only IMAP folder(s) and NNTP newsgroup(s).