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


nagachika-san, thank you for your reply!

nagachika (Tomoyuki Chikanaga) wrote in #note-2:
> I worried about a kind of discontinuity of the some deprecation warnings.

I agree that it is best to disable only keyword-related warnings.  If you who is 2.7 branch maintainer are okay for an unnecessarily big new feature towards 2.7, I'm happy to create a patch.

> I propose to introduce the dependent category for "keyword arguments" to controll warnings for the 3.0 keyword arguments and backport it into the ruby_2_7 branch.

Let me confirm: what do you mean "dependent"?

Let's call the new category "`:keyword_deprecated`".  `Warning[:deprecated]` is true by default, and `Warning[:keyword_deprecated]` is false by default.  I think that the following behavior is expected:

| `Warning[:deprecated]` | `Warning[:keyword_deprecated]` | IO#lines deprecation | keyword deprecation |
|------------------------|--------------------------------|----------------------|---------------------|
| true (default)         | false (default)                | printed              | not printed         |
| true                   | true                           | printed              | printed             |
| false                  | false                          | not printed          | not printed         |
| false                  | true                           | not printed          | printed             |



But this new category is not "dependent" on `:deprecated` category.  Rather, they are independent.  Is this okay?  Or is your expectation different?


> I think introducing the new warning category has less impacto for compatibility than changing the deprecated warning default behavior.

Adding a new category means that we need to change not only 2.7 branch but also master branch.  In master, we need to accept (and just ignore) `Warning[:keyword_deprecated] = true`.  We need to get approval from matz.

----------------------------------------
Feature #17000: 2.7.2 turns off deprecation warnings by deafult
https://bugs.ruby-lang.org/issues/17000#change-86379

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: nagachika (Tomoyuki Chikanaga)
----------------------------------------
Matz has decided to disable deprecation warnings for 3.0 keyword separation by default because many users feel them noisy and painful rather than useful.  See https://discuss.rubyonrails.org/t/new-2-7-3-0-keyword-argument-pain-point/74980/47 .

https://github.com/ruby/ruby/pull/3273 is a pull request for the change.  It is essentially one-line change in `error.c`, though it has many changes for tests that checks if the warning is appropriately emitted.

Note that this changeset disables *all* deprecation warnings by default.  The reason why I stop not only keyword-related deprecation warnings but all other ones is because, if we disable only keyword-related deprecation warnings, and if keep other deprecation on by default, it becomes ambiguous what `Warning[:deprecated]` should return.  We considered a new API like `Warning[:keyword_separation_deprecated] = true / false`, but we want to minimize the change because it goes to 2.7 branch.  Fortunately, there are not so many other warnings disabled together; a notable one is `Capturing the given block using Kernel#proc is deprecated; use `&block` instead`, but other warnings are minor, as far as I see.  It is somewhat unfortunate, but matz has already agreed with this direction.

Matz also said in the forum, "we will move on to the new keyword argument behavior in Ruby3.0 as planned".  This violates the traditional convention that "gradually" makes deprecation warnings noisy: deprecated behavior is (1) warned only when VERBOSE is enabled, (2) always warned, and (3) removed.  However, matz made this decision due to special circumstances of 3.0 keyword arguments; delaying the change will be also painful.

Note that, currently, the deprecation convention itself is not changed, so this patch is *not* going to master branch.  We can discuss the deprecation policy change in another ticket, if needed.  Anyway, let this ticket focus on ruby_2_7 branch change.  Please do not discuss the convention change in this ticket.

The final decision is up to 2.7 branch maintainer, @nagachika san, but I hope this change is accepted.

cc/ @jeremyevans0 @eregon @nobu @nagachika



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>