Issue #16253 has been updated by Dan0042 (Daniel DeLorme).


Given the very interesting use case that zverok presented, I'm leaning more in favor of a lexically-scoped "operator" that doesn't need to be present in the method signature. So no invocation via block, just like `super`. Actually, the more it behaves similary to `super`, the easier it is to explain. So it would allow things like this:

```ruby
def foo(a, b, c, d=1, e=2, f=3, g:10, h:11, i:12, j:false)
  super(42, ***) or @bar.foo(54, ***)
  #here, `super(***)` would be equivalent to `super`
end
```

(I've become partial to `***` because it looks like a splat plus a double splat, which is kind of what this shorthand means)

----------------------------------------
Feature #16253: Shorthand "forward everything" syntax
https://bugs.ruby-lang.org/issues/16253#change-82079

* Author: Dan0042 (Daniel DeLorme)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
What about using this:

```ruby
  def foo(*)
    @bar.foo(*)
```

to mean this:

```ruby
  def foo(*a, **o, &b)
    @bar.foo(*a, **o, &b)
```

I used `def foo(*)` because that's currently valid ruby code, but I'm fine with any syntax.

It's like the no-parentheses `super` shorthand, but for any method.

It makes it easier to write correct forwarding code. 

If rubyists must be told they have to change their forwarding code in 2.7 (due to keyword arguments), the pill might be easier to swallow if the change is a reduction rather than an increase in verbosity.

And we'd even be future-proof if an eventual FOURTH kind of parameter is introduced!!!!




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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>