From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-2.8 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 6D5921F454 for ; Sun, 10 Nov 2019 22:57:19 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id E64AD1209C3; Mon, 11 Nov 2019 07:57:08 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 88E921209A7 for ; Mon, 11 Nov 2019 07:57:06 +0900 (JST) Received: by filter0138p3mdw1.sendgrid.net with SMTP id filter0138p3mdw1-7200-5DC895C4-F 2019-11-10 22:57:08.234862321 +0000 UTC m=+264822.886395334 Received: from herokuapp.com (unknown [3.92.225.197]) by ismtpd0005p1iad1.sendgrid.net (SG) with ESMTP id HjqaT8GSRbq056Alal36jA for ; Sun, 10 Nov 2019 22:57:08.216 +0000 (UTC) Date: Sun, 10 Nov 2019 22:57:08 +0000 (UTC) From: eregontp@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 71407 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16253 X-Redmine-Issue-Author: Dan0042 X-Redmine-Sender: Eregon X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?KippOI8ZHtTweq7XfQzW93937kJ4QNWwSBuHnaMEcr3ZTAdzu+lZL9qjicFyfk?= =?us-ascii?Q?iMOobKxQPw7sQrHN0GH+Wh98YkUkc2PXVSFNj9j?= =?us-ascii?Q?lyBxNTUo8sPYhyd2=2Fkw=2Fghh30NWbMECsmaScAgc?= =?us-ascii?Q?3JG=2FBnYhIyAVNFOFLhD4AV1we57d+Ypd2rYS=2FV8?= =?us-ascii?Q?OazLXOwZLE9m+q=2F+J3G7y=2FnHGAzXYDvkfWw=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95782 Subject: [ruby-core:95782] [Ruby master Feature#16253] Shorthand "forward everything" syntax X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" 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/