ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: mame@ruby-lang.org
To: ruby-core@ruby-lang.org
Subject: [ruby-core:95651] [Ruby master Feature#16289] Reduce duplicated warnings for the change of Ruby 3 keyword arguments
Date: Sat, 02 Nov 2019 08:00:59 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-82439.20191102080058.85d6f6e72b632204@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-16289.20191101032931@ruby-lang.org

Issue #16289 has been updated by mame (Yusuke Endoh).


What I worry about is Jeremy's comment in the PR:

> In terms of idea, whether we want this feature depends on how annoying we want the warnings to be. If they warn every call, they are very annoying and it will push people to fixing the issue. If they only warn once, they are not that annoying, and people may be less inclined to fix the issue.

It is really convincing.  That being said, I'm afraid if it is too annoying.

I'd like to hear opinions and discuss it at the next meeting, so I've created this ticket.

----------------------------------------
Feature #16289: Reduce duplicated warnings for the change of Ruby 3 keyword arguments
https://bugs.ruby-lang.org/issues/16289#change-82439

* 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	other threads:[~2019-11-02  8:01 UTC|newest]

Thread overview: 23+ 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] [Ruby master Feature#16289] Reduce duplicated warnings for the change of Ruby 3 keyword arguments 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 ` mame [this message]
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 ` [ruby-core:95775] " eregontp
2019-11-10 22:20 ` [ruby-core:95780] " sam.saffron
2019-11-11  1:00 ` [ruby-core:95783] " sam.saffron
2019-11-29  8:12 ` [ruby-core:96025] " mame
2019-12-23  7:37 ` [ruby-core:96418] " ruby-core
2019-12-23 11:49 ` [ruby-core:96425] " mame
2019-12-23 12:51 ` [ruby-core:96427] " eregontp
2019-12-23 17:47 ` [ruby-core:96439] " merch-redmine
2019-12-23 21:49 ` [ruby-core:96441] " ruby-core
2019-12-24  7:06 ` [ruby-core:96452] " mame
2019-12-24  7:10 ` [ruby-core:96453] " matz
2019-12-24  7:23 ` [ruby-core:96455] " mame
2019-12-24  7:34 ` [ruby-core:96456] " mame

Reply instructions:

You may reply publicly 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-82439.20191102080058.85d6f6e72b632204@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).