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=-4.1 required=3.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY 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 6AE261F55B for ; Fri, 15 May 2020 06:00:49 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id E70A0120B6C; Fri, 15 May 2020 15:00:24 +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 53F82120B6B for ; Fri, 15 May 2020 15:00:22 +0900 (JST) Received: by filter0135p3las1.sendgrid.net with SMTP id filter0135p3las1-28320-5EBE3008-BB 2020-05-15 06:00:40.290437684 +0000 UTC m=+2534295.581581944 Received: from herokuapp.com (unknown) by ismtpd0109p1mdw1.sendgrid.net (SG) with ESMTP id Hv8PcaH2TIiDsAb86sCatw for ; Fri, 15 May 2020 06:00:40.211 +0000 (UTC) Date: Fri, 15 May 2020 06:00:40 +0000 (UTC) From: nobu@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 74171 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 16854 X-Redmine-Issue-Author: jamesnakagawa X-Redmine-Sender: nobu 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?q8Dly+pU2+3ektTtZVXgZtbJPXwqo7p86jCsvYTW4Bycvx2mOXaBDpa99xRu2t?= =?us-ascii?Q?DIxirlz9hLkXiROVKqqy4Xg+JrNZ4VsTEcFr9PD?= =?us-ascii?Q?DfM02LlIGtA3aVn8lVXwXBP2tBWVEJlVspKfvff?= =?us-ascii?Q?Y9dChvGvP4qdaATkpNBzV9y9qZ0B6OvnlnVlqPe?= =?us-ascii?Q?+fTBA=2FXlquQIlmWvlHr5OOzj1ImvXO1=2FXrQ=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 98379 Subject: [ruby-core:98379] [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 nobu (Nobuyoshi Nakada). It results in a syntax error, right? https://github.com/ruby/ruby/pull/3112 ---------------------------------------- Bug #16854: Using (...) when the method name is a keyword generates error https://bugs.ruby-lang.org/issues/16854#change-85647 * 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/