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-Status: No, score=-2.6 required=3.0 tests=AWL,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,UNPARSEABLE_RELAY 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 56B011F55B for ; Wed, 13 May 2020 17:32:19 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id E21C2120AA0; Thu, 14 May 2020 02:31:54 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id E87E1120A9F for ; Thu, 14 May 2020 02:31:52 +0900 (JST) Received: by filterdrecv-p3mdw1-6dbfd75bfd-br5mk with SMTP id filterdrecv-p3mdw1-6dbfd75bfd-br5mk-18-5EBC2F1E-2A 2020-05-13 17:32:14.250437622 +0000 UTC m=+4206298.204210452 Received: from herokuapp.com (unknown) by ismtpd0038p1iad2.sendgrid.net (SG) with ESMTP id hGYzvA42QB6v2QEbNgtpaA for ; Wed, 13 May 2020 17:32:14.196 +0000 (UTC) Date: Wed, 13 May 2020 17:32:14 +0000 (UTC) From: shevegen@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 74086 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 16854 X-Redmine-Issue-Author: jamesnakagawa X-Redmine-Sender: shevegen 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?6lbdtOg4RDRLuxD00eQtQKgoNAsge5d4xND7cbMQd0wQF+pH9hcAVBBcLXspjT?= =?us-ascii?Q?cZpiOndEVQfaOjab96ycerlFaZIdEgzRTp8edj4?= =?us-ascii?Q?jLpnI6gr4JqABzlTudmD8Bop1ZHccS+1Ec3L9ap?= =?us-ascii?Q?4Uj7wa7wMCHqqNSITetOZGrQiOjgzNN1pDIpzlZ?= =?us-ascii?Q?EafNC1M+FqBorDqe6ChAU2W4R2Ay3Ee0HY2EAxx?= =?us-ascii?Q?CB5o+A6sBWQV5hNZg=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 98325 Subject: [ruby-core:98325] [Ruby master Bug#16854] Using (...) when the method name is a keyword generates error 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 #16854 has been updated by shevegen (Robert A. Heiler). Interesting find and explanation. ---------------------------------------- Bug #16854: Using (...) when the method name is a keyword generates error https://bugs.ruby-lang.org/issues/16854#change-85563 * Author: jamesnakagawa (James Nakagawa) * Status: Open * Priority: Normal * ruby -v: 2.7.0 * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- Although I wouldn't generally recommend it, naming a method `true` is allowed. However, in combination with the new argument forwarding keyword `...`, a syntax error is generated which does not occur with other argument choices. This came up for me on my Rails project where an enumerated database column was defined to allow the values `:true`, `:false` (not an unreasonable request in itself). Active Record's generated class tried to contain methods by these names. Try this code for yourself: ```ruby class Works def true(*args) puts(*args) end end Works.new.true 1, 2, 3 # => 1, 2, 3 class WontWork def true(...) puts(...) end end # => freezes ``` -- https://bugs.ruby-lang.org/