Project

General

Profile

Actions

Feature #16253

closed

Shorthand "forward everything" syntax

Added by Dan0042 (Daniel DeLorme) over 4 years ago. Updated over 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:95338]

Description

What about using this:

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

to mean this:

  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!!!!


Related issues 3 (2 open1 closed)

Related to Ruby master - Misc #16157: What is the correct and *portable* way to do generic delegation?OpenActions
Related to Ruby master - Feature #16296: Alternative behavior for `...` in method body if `...` is not in method definitionOpenActions
Related to Ruby master - Feature #16378: Support leading arguments together with ...Closedmatz (Yukihiro Matsumoto)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0