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=-3.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham 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 A59CE1F4C0 for ; Wed, 16 Oct 2019 17:32:48 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 34EEF120A5B; Thu, 17 Oct 2019 02:32:39 +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 1058F12099A for ; Thu, 17 Oct 2019 02:32:36 +0900 (JST) Received: by filter0090p3las1.sendgrid.net with SMTP id filter0090p3las1-28321-5DA75432-94 2019-10-16 17:32:34.79711741 +0000 UTC m=+428325.784302168 Received: from herokuapp.com (unknown [54.158.28.124]) by ismtpd0051p1iad1.sendgrid.net (SG) with ESMTP id S10GTJ3nTBKexAr3gXg_QQ for ; Wed, 16 Oct 2019 17:32:34.552 +0000 (UTC) Date: Wed, 16 Oct 2019 17:32:34 +0000 (UTC) From: daniel@dan42.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 70959 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16253 X-Redmine-Issue-Author: Dan0042 X-Redmine-Sender: Dan0042 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?8sy4RigFvRTdBfCVJrT9zb2J88PC92TMQwdNgaWYaq7jssnhFfCs8a=2FxDnIiFW?= =?us-ascii?Q?PEY0679FPoGfvS0nae2T5PZyNWtIDWDysX1YpJ0?= =?us-ascii?Q?2OTPpFyMYB7MqlEQjp93Etr+3+EmdwaUuZXR+DS?= =?us-ascii?Q?MGS8zhyzsCtv+4vek4VFyAZFuTrvE6H5kTIC6t2?= =?us-ascii?Q?TYr6foS8OblBZuUflg4pq97MuwG0RPpCzqA=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95371 Subject: [ruby-core:95371] [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 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/