From: eregontp@... Date: 2019-11-10T22:57:08+00:00 Subject: [ruby-core:95782] [Ruby master Feature#16253] Shorthand "forward everything" syntax Issue #16253 has been updated by Eregon (Benoit Daloze). jeremyevans0 (Jeremy Evans) wrote: > It is true that this means the syntax only handles a subset of delegation methods. You can always do things the longer way if you need more control: Right, except if one wants that code to work on Ruby 2.7+. I think `...` could be part of how to do delegation right in the future, succinctly: https://eregon.me/blog/2019/11/10/the-delegation-challenge-of-ruby27.html I think leading required arguments are the most most needed in delegation. ---------------------------------------- Feature #16253: Shorthand "forward everything" syntax https://bugs.ruby-lang.org/issues/16253#change-82606 * 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: