ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / Atom feed
From: eregontp@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:95775] [Ruby master Feature#16289] Reduce duplicated warnings for the change of Ruby 3 keyword arguments
Date: Sun, 10 Nov 2019 11:24:34 +0000 (UTC)
Message-ID: <redmine.journal-82594.20191110112434.6e6ad31347d540e1@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-16289.20191101032931@ruby-lang.org>

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/

  parent reply index

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-16289.20191101032931@ruby-lang.org>
2019-11-01  3:29 ` [ruby-core:95627] " mame
2019-11-01  4:43   ` [ruby-core:95630] " Eric Wong
2019-11-01  4:38 ` [ruby-core:95629] " ruby-core
2019-11-01  7:03 ` [ruby-core:95631] " nobu
2019-11-01 13:26 ` [ruby-core:95634] " mame
2019-11-02  8:00 ` [ruby-core:95651] " mame
2019-11-02 12:56 ` [ruby-core:95653] " eregontp
2019-11-02 15:47 ` [ruby-core:95655] " ruby-core
2019-11-04 16:41 ` [ruby-core:95670] " daniel
2019-11-05  9:35 ` [ruby-core:95692] " shevegen
2019-11-10 11:24 ` eregontp [this message]
2019-11-10 22:20 ` [ruby-core:95780] " sam.saffron
2019-11-11  1:00 ` [ruby-core:95783] " sam.saffron

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-82594.20191110112434.6e6ad31347d540e1@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ruby-core@ruby-lang.org archive (unofficial mirror)

Archives are clonable: git clone --mirror https://public-inbox.org/ruby-core

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.core
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.core
	nntp://news.gmane.org/gmane.comp.lang.ruby.core

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git