* [ruby-core:97283] [Ruby master Feature#16378] Support leading arguments together with ...
[not found] <redmine.issue-16378.20191127165022.772@ruby-lang.org>
@ 2020-02-27 7:08 ` matz
2020-05-28 11:44 ` [ruby-core:98558] " eregontp
` (10 subsequent siblings)
11 siblings, 0 replies; 12+ messages in thread
From: matz @ 2020-02-27 7:08 UTC (permalink / raw)
To: ruby-core
Issue #16378 has been updated by matz (Yukihiro Matsumoto).
We have found out that `#method_missing` (and `#send`) needed leading arguments otherwise we cannot use argument forwarding for them. I changed my mind. Accepted.
Matz.
----------------------------------------
Feature #16378: Support leading arguments together with ...
https://bugs.ruby-lang.org/issues/16378#change-84400
* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 3.0
----------------------------------------
I think this is very important, otherwise `...` can be used only very rarely.
For instance, `method_missing` typically want to access the method name like:
```ruby
def method_missing(name, ...)
if name.to_s.end_with?('?')
self[name]
else
fallback(name, ...)
end
end
```
See the original feature: https://bugs.ruby-lang.org/issues/16253#note-19.
I think most people expect `def method_missing(name, ...)` to work.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:98558] [Ruby master Feature#16378] Support leading arguments together with ...
[not found] <redmine.issue-16378.20191127165022.772@ruby-lang.org>
2020-02-27 7:08 ` [ruby-core:97283] [Ruby master Feature#16378] Support leading arguments together with matz
@ 2020-05-28 11:44 ` eregontp
2020-05-28 18:11 ` [ruby-core:98560] " merch-redmine
` (9 subsequent siblings)
11 siblings, 0 replies; 12+ messages in thread
From: eregontp @ 2020-05-28 11:44 UTC (permalink / raw)
To: ruby-core
Issue #16378 has been updated by Eregon (Benoit Daloze).
Interesting, I never saw the reply above from matz.
Looking at my email I received one but it wasn't attached to the rest of the conversation for this issue for some reason.
Great to hear it's now accepted.
I think we should have it already in 2.7.2+.
Many people clearly want it in #16891.
@jeremyevans0 or @nobu Could you implement it on `master`?
----------------------------------------
Feature #16378: Support leading arguments together with ...
https://bugs.ruby-lang.org/issues/16378#change-85852
* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 3.0
----------------------------------------
I think this is very important, otherwise `...` can be used only very rarely.
For instance, `method_missing` typically want to access the method name like:
```ruby
def method_missing(name, ...)
if name.to_s.end_with?('?')
self[name]
else
fallback(name, ...)
end
end
```
See the original feature: https://bugs.ruby-lang.org/issues/16253#note-19.
I think most people expect `def method_missing(name, ...)` to work.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:98560] [Ruby master Feature#16378] Support leading arguments together with ...
[not found] <redmine.issue-16378.20191127165022.772@ruby-lang.org>
2020-02-27 7:08 ` [ruby-core:97283] [Ruby master Feature#16378] Support leading arguments together with matz
2020-05-28 11:44 ` [ruby-core:98558] " eregontp
@ 2020-05-28 18:11 ` merch-redmine
2020-06-05 22:45 ` [ruby-core:98662] " merch-redmine
` (8 subsequent siblings)
11 siblings, 0 replies; 12+ messages in thread
From: merch-redmine @ 2020-05-28 18:11 UTC (permalink / raw)
To: ruby-core
Issue #16378 has been updated by jeremyevans0 (Jeremy Evans).
Eregon (Benoit Daloze) wrote in #note-10:
> @jeremyevans0 or @nobu Could you implement it on `master`?
I've implemented basic support, which passes make check: https://github.com/jeremyevans/ruby/commit/672901facca6f88ae40b4ea8ef59ef04efd5a5de
I think ripper support is probably broken for it, and the idFWD_KWREST sections (not currently enabled) are probably also wrong.
@nobu, could you please fix the ripper support and idFWD_KWREST sections?
----------------------------------------
Feature #16378: Support leading arguments together with ...
https://bugs.ruby-lang.org/issues/16378#change-85857
* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 3.0
----------------------------------------
I think this is very important, otherwise `...` can be used only very rarely.
For instance, `method_missing` typically want to access the method name like:
```ruby
def method_missing(name, ...)
if name.to_s.end_with?('?')
self[name]
else
fallback(name, ...)
end
end
```
See the original feature: https://bugs.ruby-lang.org/issues/16253#note-19.
I think most people expect `def method_missing(name, ...)` to work.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:98662] [Ruby master Feature#16378] Support leading arguments together with ...
[not found] <redmine.issue-16378.20191127165022.772@ruby-lang.org>
` (2 preceding siblings ...)
2020-05-28 18:11 ` [ruby-core:98560] " merch-redmine
@ 2020-06-05 22:45 ` merch-redmine
2020-06-19 7:40 ` [ruby-core:98880] " mame
` (7 subsequent siblings)
11 siblings, 0 replies; 12+ messages in thread
From: merch-redmine @ 2020-06-05 22:45 UTC (permalink / raw)
To: ruby-core
Issue #16378 has been updated by jeremyevans0 (Jeremy Evans).
jeremyevans0 (Jeremy Evans) wrote in #note-12:
> Eregon (Benoit Daloze) wrote in #note-10:
> > @jeremyevans0 or @nobu Could you implement it on `master`?
>
> I've implemented basic support, which passes make check: https://github.com/jeremyevans/ruby/commit/672901facca6f88ae40b4ea8ef59ef04efd5a5de
>
> I think ripper support is probably broken for it, and the idFWD_KWREST sections (not currently enabled) are probably also wrong.
>
> @nobu, could you please fix the ripper support and idFWD_KWREST sections?
From my testing, the existing idFWD_KWREST sections for `...` without leading arguments are already broken. Defining `RUBY3_KEYWORDS` in parse.y results in broken code such as args being dropped and `no implicit conversion of nil into Hash (TypeError)` when using super. So I don't think there is a point trying to get idFWD_KWREST sections working for leading arguments currently. We are not going to want to switch to idFWD_KWREST sections until we drop `ruby2_keywords` support, as `ruby2_keywords` is significantly faster.
I updated the commit to add ripper support, and added a pull request for it: https://github.com/ruby/ruby/pull/3190
----------------------------------------
Feature #16378: Support leading arguments together with ...
https://bugs.ruby-lang.org/issues/16378#change-86001
* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 3.0
----------------------------------------
I think this is very important, otherwise `...` can be used only very rarely.
For instance, `method_missing` typically want to access the method name like:
```ruby
def method_missing(name, ...)
if name.to_s.end_with?('?')
self[name]
else
fallback(name, ...)
end
end
```
See the original feature: https://bugs.ruby-lang.org/issues/16253#note-19.
I think most people expect `def method_missing(name, ...)` to work.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:98880] [Ruby master Feature#16378] Support leading arguments together with ...
[not found] <redmine.issue-16378.20191127165022.772@ruby-lang.org>
` (3 preceding siblings ...)
2020-06-05 22:45 ` [ruby-core:98662] " merch-redmine
@ 2020-06-19 7:40 ` mame
2020-06-19 16:22 ` [ruby-core:98891] " merch-redmine
` (6 subsequent siblings)
11 siblings, 0 replies; 12+ messages in thread
From: mame @ 2020-06-19 7:40 UTC (permalink / raw)
To: ruby-core
Issue #16378 has been updated by mame (Yusuke Endoh).
@nagachika Can we backport this to 2.7.2? Strictly speaking, this is a new feature, but according to [public consultation about Ruby 3.0 keyword change](https://discuss.rubyonrails.org/t/new-2-7-3-0-keyword-argument-pain-point/74980), this seems important to mitigate the pain of the change in 2.7. Matz also agreed with the backport.
@JeremyEvans0 If nagachika-san agreed with the backport, can you create a patch for backport?
----------------------------------------
Feature #16378: Support leading arguments together with ...
https://bugs.ruby-lang.org/issues/16378#change-86255
* Author: Eregon (Benoit Daloze)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 3.0
----------------------------------------
I think this is very important, otherwise `...` can be used only very rarely.
For instance, `method_missing` typically want to access the method name like:
```ruby
def method_missing(name, ...)
if name.to_s.end_with?('?')
self[name]
else
fallback(name, ...)
end
end
```
See the original feature: https://bugs.ruby-lang.org/issues/16253#note-19.
I think most people expect `def method_missing(name, ...)` to work.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:98891] [Ruby master Feature#16378] Support leading arguments together with ...
[not found] <redmine.issue-16378.20191127165022.772@ruby-lang.org>
` (4 preceding siblings ...)
2020-06-19 7:40 ` [ruby-core:98880] " mame
@ 2020-06-19 16:22 ` merch-redmine
2020-06-29 7:59 ` [ruby-core:98991] " nagachika00
` (5 subsequent siblings)
11 siblings, 0 replies; 12+ messages in thread
From: merch-redmine @ 2020-06-19 16:22 UTC (permalink / raw)
To: ruby-core
Issue #16378 has been updated by jeremyevans0 (Jeremy Evans).
File ruby_2_7_lead_args_forwarding.patch added
mame (Yusuke Endoh) wrote in #note-15:
> @JeremyEvans0 If nagachika-san agreed with the backport, can you create a patch for backport?
Backport patch attached, in case @nagachika approves.
----------------------------------------
Feature #16378: Support leading arguments together with ...
https://bugs.ruby-lang.org/issues/16378#change-86266
* Author: Eregon (Benoit Daloze)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 3.0
----------------------------------------
I think this is very important, otherwise `...` can be used only very rarely.
For instance, `method_missing` typically want to access the method name like:
```ruby
def method_missing(name, ...)
if name.to_s.end_with?('?')
self[name]
else
fallback(name, ...)
end
end
```
See the original feature: https://bugs.ruby-lang.org/issues/16253#note-19.
I think most people expect `def method_missing(name, ...)` to work.
---Files--------------------------------
ruby_2_7_lead_args_forwarding.patch (8.98 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:98991] [Ruby master Feature#16378] Support leading arguments together with ...
[not found] <redmine.issue-16378.20191127165022.772@ruby-lang.org>
` (5 preceding siblings ...)
2020-06-19 16:22 ` [ruby-core:98891] " merch-redmine
@ 2020-06-29 7:59 ` nagachika00
2020-12-27 19:41 ` [ruby-core:101757] " daniel
` (4 subsequent siblings)
11 siblings, 0 replies; 12+ messages in thread
From: nagachika00 @ 2020-06-29 7:59 UTC (permalink / raw)
To: ruby-core
Issue #16378 has been updated by nagachika (Tomoyuki Chikanaga).
Thank you for your notice and providing the patch. I will take a look into it.
----------------------------------------
Feature #16378: Support leading arguments together with ...
https://bugs.ruby-lang.org/issues/16378#change-86371
* Author: Eregon (Benoit Daloze)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 3.0
----------------------------------------
I think this is very important, otherwise `...` can be used only very rarely.
For instance, `method_missing` typically want to access the method name like:
```ruby
def method_missing(name, ...)
if name.to_s.end_with?('?')
self[name]
else
fallback(name, ...)
end
end
```
See the original feature: https://bugs.ruby-lang.org/issues/16253#note-19.
I think most people expect `def method_missing(name, ...)` to work.
---Files--------------------------------
ruby_2_7_lead_args_forwarding.patch (8.98 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:101757] [Ruby master Feature#16378] Support leading arguments together with ...
[not found] <redmine.issue-16378.20191127165022.772@ruby-lang.org>
` (6 preceding siblings ...)
2020-06-29 7:59 ` [ruby-core:98991] " nagachika00
@ 2020-12-27 19:41 ` daniel
2020-12-28 12:35 ` [ruby-core:101777] " eregontp
` (3 subsequent siblings)
11 siblings, 0 replies; 12+ messages in thread
From: daniel @ 2020-12-27 19:41 UTC (permalink / raw)
To: ruby-core
Issue #16378 has been updated by Dan0042 (Daniel DeLorme).
@nagachika I would really like to see this backported to 2.7 ... may I ask for the status?
----------------------------------------
Feature #16378: Support leading arguments together with ...
https://bugs.ruby-lang.org/issues/16378#change-89584
* Author: Eregon (Benoit Daloze)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 3.0
----------------------------------------
I think this is very important, otherwise `...` can be used only very rarely.
For instance, `method_missing` typically want to access the method name like:
```ruby
def method_missing(name, ...)
if name.to_s.end_with?('?')
self[name]
else
fallback(name, ...)
end
end
```
See the original feature: https://bugs.ruby-lang.org/issues/16253#note-19.
I think most people expect `def method_missing(name, ...)` to work.
---Files--------------------------------
ruby_2_7_lead_args_forwarding.patch (8.98 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:101777] [Ruby master Feature#16378] Support leading arguments together with ...
[not found] <redmine.issue-16378.20191127165022.772@ruby-lang.org>
` (7 preceding siblings ...)
2020-12-27 19:41 ` [ruby-core:101757] " daniel
@ 2020-12-28 12:35 ` eregontp
2020-12-31 6:32 ` [ruby-core:101830] " nagachika00
` (2 subsequent siblings)
11 siblings, 0 replies; 12+ messages in thread
From: eregontp @ 2020-12-28 12:35 UTC (permalink / raw)
To: ruby-core
Issue #16378 has been updated by Eregon (Benoit Daloze).
Agreed it should be in 2.7 (well, I've said since the beginning of this issue :D).
Right now, I consider `...` non-existing because it's almost never usable due to the restrictions in 2.7.
----------------------------------------
Feature #16378: Support leading arguments together with ...
https://bugs.ruby-lang.org/issues/16378#change-89605
* Author: Eregon (Benoit Daloze)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 3.0
----------------------------------------
I think this is very important, otherwise `...` can be used only very rarely.
For instance, `method_missing` typically want to access the method name like:
```ruby
def method_missing(name, ...)
if name.to_s.end_with?('?')
self[name]
else
fallback(name, ...)
end
end
```
See the original feature: https://bugs.ruby-lang.org/issues/16253#note-19.
I think most people expect `def method_missing(name, ...)` to work.
---Files--------------------------------
ruby_2_7_lead_args_forwarding.patch (8.98 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:101830] [Ruby master Feature#16378] Support leading arguments together with ...
[not found] <redmine.issue-16378.20191127165022.772@ruby-lang.org>
` (8 preceding siblings ...)
2020-12-28 12:35 ` [ruby-core:101777] " eregontp
@ 2020-12-31 6:32 ` nagachika00
2024-09-04 21:04 ` [ruby-core:119047] " esad (Esad Hajdarevic) via ruby-core
2024-09-04 21:27 ` [ruby-core:119048] " jeremyevans0 (Jeremy Evans) via ruby-core
11 siblings, 0 replies; 12+ messages in thread
From: nagachika00 @ 2020-12-31 6:32 UTC (permalink / raw)
To: ruby-core
Issue #16378 has been updated by nagachika (Tomoyuki Chikanaga).
Thank you for ping me. I backported f8b4340f into ruby_2_7 at 27fca66207f2c35f2f44f6a7cbbe6fd153546082.
----------------------------------------
Feature #16378: Support leading arguments together with ...
https://bugs.ruby-lang.org/issues/16378#change-89657
* Author: Eregon (Benoit Daloze)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 3.0
----------------------------------------
I think this is very important, otherwise `...` can be used only very rarely.
For instance, `method_missing` typically want to access the method name like:
```ruby
def method_missing(name, ...)
if name.to_s.end_with?('?')
self[name]
else
fallback(name, ...)
end
end
```
See the original feature: https://bugs.ruby-lang.org/issues/16253#note-19.
I think most people expect `def method_missing(name, ...)` to work.
---Files--------------------------------
ruby_2_7_lead_args_forwarding.patch (8.98 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:119047] [Ruby master Feature#16378] Support leading arguments together with ...
[not found] <redmine.issue-16378.20191127165022.772@ruby-lang.org>
` (9 preceding siblings ...)
2020-12-31 6:32 ` [ruby-core:101830] " nagachika00
@ 2024-09-04 21:04 ` esad (Esad Hajdarevic) via ruby-core
2024-09-04 21:27 ` [ruby-core:119048] " jeremyevans0 (Jeremy Evans) via ruby-core
11 siblings, 0 replies; 12+ messages in thread
From: esad (Esad Hajdarevic) via ruby-core @ 2024-09-04 21:04 UTC (permalink / raw)
To: ruby-core; +Cc: esad (Esad Hajdarevic)
Issue #16378 has been updated by esad (Esad Hajdarevic).
Is there a reason why this doesn't work with keyword arguments too?
For example:
```
def foo(bar:, ...)
other(...)
end
```
results in syntax error
----------------------------------------
Feature #16378: Support leading arguments together with ...
https://bugs.ruby-lang.org/issues/16378#change-109625
* Author: Eregon (Benoit Daloze)
* Status: Closed
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 3.0
----------------------------------------
I think this is very important, otherwise `...` can be used only very rarely.
For instance, `method_missing` typically want to access the method name like:
```ruby
def method_missing(name, ...)
if name.to_s.end_with?('?')
self[name]
else
fallback(name, ...)
end
end
```
See the original feature: https://bugs.ruby-lang.org/issues/16253#note-19.
I think most people expect `def method_missing(name, ...)` to work.
---Files--------------------------------
ruby_2_7_lead_args_forwarding.patch (8.98 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] 12+ messages in thread
* [ruby-core:119048] [Ruby master Feature#16378] Support leading arguments together with ...
[not found] <redmine.issue-16378.20191127165022.772@ruby-lang.org>
` (10 preceding siblings ...)
2024-09-04 21:04 ` [ruby-core:119047] " esad (Esad Hajdarevic) via ruby-core
@ 2024-09-04 21:27 ` jeremyevans0 (Jeremy Evans) via ruby-core
11 siblings, 0 replies; 12+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2024-09-04 21:27 UTC (permalink / raw)
To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)
Issue #16378 has been updated by jeremyevans0 (Jeremy Evans).
esad (Esad Hajdarevic) wrote in #note-21:
> Is there a reason why this doesn't work with keyword arguments too?
>
> For example:
> ```
> def foo(bar:, ...)
> other(...)
> end
> ```
>
> results in syntax error
Keyword arguments are not leading arguments. Trying to support what you want was not in scope. I think trying to support what you want would significantly increase the complexity, especially if you wanted to support `def foo(arg, kwarg: , ...)` as well.
You should use:
```ruby
def foo(*, bar:, **, &)
other(*, **, &)
end
```
----------------------------------------
Feature #16378: Support leading arguments together with ...
https://bugs.ruby-lang.org/issues/16378#change-109626
* Author: Eregon (Benoit Daloze)
* Status: Closed
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 3.0
----------------------------------------
I think this is very important, otherwise `...` can be used only very rarely.
For instance, `method_missing` typically want to access the method name like:
```ruby
def method_missing(name, ...)
if name.to_s.end_with?('?')
self[name]
else
fallback(name, ...)
end
end
```
See the original feature: https://bugs.ruby-lang.org/issues/16253#note-19.
I think most people expect `def method_missing(name, ...)` to work.
---Files--------------------------------
ruby_2_7_lead_args_forwarding.patch (8.98 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] 12+ messages in thread
end of thread, other threads:[~2024-09-04 21:28 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <redmine.issue-16378.20191127165022.772@ruby-lang.org>
2020-02-27 7:08 ` [ruby-core:97283] [Ruby master Feature#16378] Support leading arguments together with matz
2020-05-28 11:44 ` [ruby-core:98558] " eregontp
2020-05-28 18:11 ` [ruby-core:98560] " merch-redmine
2020-06-05 22:45 ` [ruby-core:98662] " merch-redmine
2020-06-19 7:40 ` [ruby-core:98880] " mame
2020-06-19 16:22 ` [ruby-core:98891] " merch-redmine
2020-06-29 7:59 ` [ruby-core:98991] " nagachika00
2020-12-27 19:41 ` [ruby-core:101757] " daniel
2020-12-28 12:35 ` [ruby-core:101777] " eregontp
2020-12-31 6:32 ` [ruby-core:101830] " nagachika00
2024-09-04 21:04 ` [ruby-core:119047] " esad (Esad Hajdarevic) via ruby-core
2024-09-04 21:27 ` [ruby-core:119048] " jeremyevans0 (Jeremy Evans) 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).