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 AF1831F466 for ; Thu, 2 Jan 2020 17:55:28 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id BE68F120A1F; Fri, 3 Jan 2020 02:55: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 2EBBB120A0A for ; Fri, 3 Jan 2020 02:55:06 +0900 (JST) Received: by filterdrecv-p3las1-5bf99c48d-qbhn7 with SMTP id filterdrecv-p3las1-5bf99c48d-qbhn7-19-5E0E2E7A-1B 2020-01-02 17:55:06.223265806 +0000 UTC m=+1444156.800282854 Received: from herokuapp.com (unknown [3.89.196.85]) by ismtpd0035p1iad2.sendgrid.net (SG) with ESMTP id 3cylIIMSTY2yb-uUuRxe8A for ; Thu, 02 Jan 2020 17:55:06.103 +0000 (UTC) Date: Thu, 02 Jan 2020 17:55:06 +0000 (UTC) From: aladjev.andrew@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 72294 X-Redmine-Project: ruby-master X-Redmine-Issue-Id: 16473 X-Redmine-Issue-Author: puchuu X-Redmine-Sender: puchuu 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?mfG7zESXjBxDOJCk1KZBW6JXIIiQGPpTNpj8XqxhnkuBZqbc5JMTWCloE9jsnr?= =?us-ascii?Q?7xWYIawAd15ATXGe3GzhWUpGvBq+wZw8CZoiiEC?= =?us-ascii?Q?N2kysU4UiFiOh96h3NPGAWNddL5ePPxIZ8zBfiD?= =?us-ascii?Q?GfJdfVaPS3aLpsf4cdGqp7UvTHw07qlS2KfKN8I?= =?us-ascii?Q?h1r6JIxFA+Qk+m59ePuJysL9Gn90ccuuDtzoVFw?= =?us-ascii?Q?mefdZZIrMsIh+7rEE=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 96632 Subject: [ruby-core:96632] [Ruby master Bug#16473] New deprecated warning disallows keyword arguments bypassing 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 #16473 has been updated by puchuu (Andrew Aladjev). @jeremyevans0, what will be the right way to bypass keyword arguments? ```ruby def non_kw(a = {}, **keyword_args) puts "non kw #{a}" kw **keyword_args end ``` This variant is wrong with ruby 2, because it provides: ``` non kw {:a=>2} kw 2 warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call warning: The called method `non_kw' is defined here non kw {} kw 3 non kw {} kw 1 ``` Will it work with ruby 3? Thank you. ---------------------------------------- Bug #16473: New deprecated warning disallows keyword arguments bypassing https://bugs.ruby-lang.org/issues/16473#change-83602 * Author: puchuu (Andrew Aladjev) * Status: Rejected * Priority: Normal * Assignee: * Target version: * ruby -v: 2.7.0 * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- Hello. I see that ruby 2.7.0 prints unnecessary deprecated warning during arguments bypassing. ```ruby def kw(a: 1) puts "kw #{a}" end def non_kw(a = {}, *args) puts "non kw #{a}" kw *args end non_kw({ :a => 2 }, :a => 2) non_kw({ :a => 3 }) non_kw ``` The right output is: ``` non kw {:a=>2} kw 2 non kw {:a=>3} kw 1 non kw {} kw 1 ``` Ruby 2.7.0 provides deprecated warning: ```ruby warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call ``` `*args` is bypassing arguments without any conversion. It looks like ruby converts last hash to keywords and than converts it back to hash. I think it is a bug. -- https://bugs.ruby-lang.org/