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.8 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 AE7571F454 for ; Sun, 10 Nov 2019 11:24:46 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id AB4401209D3; Sun, 10 Nov 2019 20:24:35 +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 DDC35120939 for ; Sun, 10 Nov 2019 20:24:32 +0900 (JST) Received: by filter0076p3las1.sendgrid.net with SMTP id filter0076p3las1-11289-5DC7F372-25 2019-11-10 11:24:34.690593522 +0000 UTC m=+221292.306703663 Received: from herokuapp.com (unknown [3.92.225.197]) by ismtpd0004p1iad1.sendgrid.net (SG) with ESMTP id Atabo-f2SB2ZN4lM6akMTA for ; Sun, 10 Nov 2019 11:24:34.522 +0000 (UTC) Date: Sun, 10 Nov 2019 11:24:34 +0000 (UTC) From: eregontp@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 71400 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16289 X-Redmine-Issue-Author: mame X-Redmine-Sender: Eregon 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?KippOI8ZHtTweq7XfQzW93937kJ4QNWwSBuHnaMEcr2U6SDMtLTpS5aC4dHC0l?= =?us-ascii?Q?NM3vNHdZEqubX0jPQRgXQ4RrLa=2FajkzbWWDPk8G?= =?us-ascii?Q?4TdMKi1uZ93Twze592xZncBulnZ7TWrgx5QNj=2Fo?= =?us-ascii?Q?qzWtZutnHUb5SMeXC5WqoDArpMMf8m1+fmP2zd1?= =?us-ascii?Q?4L46w7CvN6N4GJ=2Fz6iRtBfSs1DXxlHd1ZRg=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95775 Subject: [ruby-core:95775] [Ruby master Feature#16289] Reduce duplicated warnings for the change of Ruby 3 keyword arguments 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 #16289 has been updated by Eregon (Benoit Daloze). I updated the benchmark results above and measured on this branch. It's ~100x faster in that micro benchmark. If we don't want pretty bad performance when migrating to 2.7 without fixing kwargs warnings (which probably takes a long time for application with many dependencies), then I think we need this. ---------------------------------------- Feature #16289: Reduce duplicated warnings for the change of Ruby 3 keyword arguments https://bugs.ruby-lang.org/issues/16289#change-82594 * Author: mame (Yusuke Endoh) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- ## Problem Currently, the interpreter emits 200 lines of warnings against the following program. ```ruby def foo(**opt); end 100.times { foo({kw:1}) } ``` ``` $ ./miniruby -e 'def foo(**opt); end; 100.times { foo({kw:1}) }' -e:1: warning: The last argument is used as the keyword parameter -e:1: warning: for `foo' defined here -e:1: warning: The last argument is used as the keyword parameter -e:1: warning: for `foo' defined here -e:1: warning: The last argument is used as the keyword parameter -e:1: warning: for `foo' defined here ... ``` In theory, the warnings are not harmful because they don't stop or interfere the execution. But in practice, I'm afraid if they are annoying because they flush all console logs away. I think that the warning is not needed if the call is already warned. ## Proposal How about limiting the count of warnings to at most once for each pair of caller and callee? I've created [a pull request](https://github.com/ruby/ruby/pull/2458). It records all pairs of caller position and callee iseq when emitting a warning, and suppress the warning if the same pair of caller and callee is already warned. What do you think? -- https://bugs.ruby-lang.org/