From: "aaronjensen (Aaron Jensen)" Date: 2022-03-18T18:25:42+00:00 Subject: [ruby-core:107986] [Ruby master Feature#18648] ruby2_keywords and ... name arguments with impossible names Issue #18648 has been updated by aaronjensen (Aaron Jensen). bkuhlmann (Brooke Kuhlmann) wrote in #note-2: > Hey Aaron, in regards to `*`, `**`, and `&`, those are passthrough parameters (or bare parameters as I like to call them). Ok, but why doesn't ... create them in this way? Why assign them a name? > > Why does only block get the faux name? > > One of the uses cases is so that you can pass the anonymous block up to the parent ... > This is syntactic sugar for not having to name your block if you don't need to. No offense to any who worked on it, but this seems like an unnecessary complexity. "As bloc argument is frequently called just block, the absence of the name doesn���t affect readability." is likely false. It makes anyone who has ever done Ruby have to pause and say what is this? How does it work? It also introduces a non-backwards compatible change in exchange for that hit to readability. ---------------------------------------- Feature #18648: ruby2_keywords and ... name arguments with impossible names https://bugs.ruby-lang.org/issues/18648#change-96938 * Author: aaronjensen (Aaron Jensen) * Status: Feedback * Priority: Normal ---------------------------------------- While investigating a break in a library using reflection, I realized that when ... is used or ruby2_keywords is used that Ruby will name arguments with their symbol, rather than leaving them unnamed. This test demonstrates the issue: https://github.com/ruby/ruby/blob/97426e15d721119738a548ecfa7232b1d027cd34/test/ruby/test_method.rb#L35 https://github.com/ruby/ruby/blob/97426e15d721119738a548ecfa7232b1d027cd34/test/ruby/test_method.rb#L586 I do not understand how `:*`, `:**`, and `:&` are meant to be considered valid parameter names. I assume the reason is so that they do not conflict with something a person could write but that they can still be referenced in Ruby to facilitate delegation but I just wanted to report that it caused a problem downstream. It's also curious that: ``` def foo(*, **, &) end ``` Gives these parameter: `[[:rest], [:keyrest], [:block, :&]]` Why does only `block` get the faux name? Is it because that's how yield works so there needs to be a way to reference it in Ruby? -- https://bugs.ruby-lang.org/ Unsubscribe: