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.7 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 BB2361F463 for ; Tue, 31 Dec 2019 17:30:37 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 95945120977; Wed, 1 Jan 2020 02:30:20 +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 9CC4F120976 for ; Wed, 1 Jan 2020 02:30:18 +0900 (JST) Received: by filterdrecv-p3las1-5bf99c48d-527wg with SMTP id filterdrecv-p3las1-5bf99c48d-527wg-18-5E0B85B0-132 2019-12-31 17:30:25.001476735 +0000 UTC m=+1269875.736976412 Received: from herokuapp.com (unknown [54.196.3.15]) by ismtpd0001p1iad1.sendgrid.net (SG) with ESMTP id Y5qjqZlcRb2OPIsos0BISQ for ; Tue, 31 Dec 2019 17:30:24.807 +0000 (UTC) Date: Tue, 31 Dec 2019 17:30:25 +0000 (UTC) From: aaronc20000@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 72271 X-Redmine-Project: ruby-master X-Redmine-Issue-Id: 16456 X-Redmine-Issue-Author: aaronc81 X-Redmine-Sender: aaronc81 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?vDwfuvxx8qZ+B2=2FvepzSSe8vie0VPxU8aM3vPWA7FppSWLn3Kx4MuqPUtJhVrz?= =?us-ascii?Q?4X4fgBoHzjONPo02ad90l9MHjOt4EXsFxn0FrFN?= =?us-ascii?Q?xJT9t86r7QzcP46NfwsUui3uCOE+FZ1NJteMbBx?= =?us-ascii?Q?FFCPhzcCUh2ybonu39j27FjCo0YaJZT5iWxGMGk?= =?us-ascii?Q?rgNbPiTc6FDwe4+l=2F5qxNYfQn7ogNgHJqmwUv09?= =?us-ascii?Q?nVDoJOi1IhRAhiVHE=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 96608 Subject: [ruby-core:96608] [Ruby master Feature#16456] Ruby 2.7 argument delegation (...) should be its own kind of parameter in Method#parameters 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 #16456 has been updated by aaronc81 (Aaron Christiansen). I think that the `[[:rest, :"..."], [:keyrest, :"..."], [:block, :"..."]]` solution looks like a good option, as it keeps roughly the same behaviour while adding the differentiation between `*args, &blk` and `...`. ---------------------------------------- Feature #16456: Ruby 2.7 argument delegation (...) should be its own kind of parameter in Method#parameters https://bugs.ruby-lang.org/issues/16456#change-83578 * Author: aaronc81 (Aaron Christiansen) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- A method defined with `...` as its parameter list is equivalent to one defined with `*args, &blk`, according to `Method#parameters`. ```ruby def foo(...); end p method(:foo).parameters # => [[:rest, :*], [:block, :&]] ``` Even in Ruby 2.7, `...` and `*args, &blk` are not *quite* equivalent as the latter may produce a warning where the former does not. In Ruby 3.0 and beyond, `...` and `*args, &blk` will have a substantial semantic difference. Due to this, I don't consider the current behaviour of `Method#parameters` particularly ideal when dealing with methods using this new syntax. If the goal of `...` is to be a "delegate everything" operator, even when parameter passing is changed like in Ruby 3.0, I would propose that `Method#parameters` considers it a unique type of parameter. For example: ```ruby def foo(...); end p method(:foo).parameters # => [[:delegate, :"..."]] ``` -- https://bugs.ruby-lang.org/