From: samuel@... Date: 2019-10-19T02:56:37+00:00 Subject: [ruby-core:95428] [Ruby master Feature#16253] Shorthand "forward everything" syntax Issue #16253 has been updated by ioquatix (Samuel Williams). The reason to support `...` with other args is something like this: ``` class Controller < Container::Controller def initialize(command, *arguments, **options, &block) @command = command super(*arguments, **options, &block) end end # Nicer? class Controller < Container::Controller def initialize(command, ...) @command = command super(...) end end ``` I think `...` should be remainder of arguments that aren't explicitly consumed. Semantics might be a little bit more tricky to implement, but it makes a lot of sense to me and there are *many* places where such a syntax would make things not only clearer, but also faster by eliding allocations for `*arguments` and `**options`. ---------------------------------------- Feature #16253: Shorthand "forward everything" syntax https://bugs.ruby-lang.org/issues/16253#change-82182 * 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: