Issue #16345 has been updated by duerst (Martin D=FCrst).


I like this feature because it would make it easier to get a grip on the va=
rious features in Ruby that are scheduled for deprecation. Currently, we do=
n't have an overall picture of what is deprecated and when and how we plan =
to remove it. Ideally, deprecation warnings should come with additional inf=
ormation, i.e. version where the feature will be removed, and/or issue on t=
his tracker where the details are.

I'm not sure making `Warning.disable(:deprecated)` the default is the best =
thing to do, because it won't help people who use Ruby just for simple scri=
pting (without an explicit deploy process). It may be better for deployment=
s to explicitly set `Warning.enable(:deprecated)`.

----------------------------------------
Feature #16345: Don't emit deprecation warnings by default.
https://bugs.ruby-lang.org/issues/16345#change-82634

* Author: akr (Akira Tanaka)
* Status: Open
* Priority: Normal
* Assignee: =

* Target version: =

----------------------------------------
We propose that Ruby doesn't emit deprecation warnings by default.

Deprecation warnings are only useful when development for updating Ruby ver=
sion.
They are not useful when development for current Ruby.
They are especially frustrated when deprecated warnings are generated in ge=
ms.
Also, deprecation warnings are totally useless for production environment.

So, we want to emit deprecation warnings only for useful situations.

We propose a command line argument `-W:deprecated` (or `--warning=3Ddepreca=
ted`)
and following methods to enable/disable deprecation warnings.

```ruby
Warning.disable(:deprecated)
Warning.enable(:deprecated)
Warning.enabled?(:deprecated)
```

Currently we don't propose a method to generate a deprecation warning
because current our main intent is disabling deprecation warnings for =

keyword arguments and the warnings are generated in C level.

Background:

We discussed about keyword arguments at a developer meeting (2019-11-12).
https://bugs.ruby-lang.org/issues/16333
We expect many deprecation warnings will be generated in Ruby 2.7.
They are not useful except development for Ruby transition and
they may block transition to Ruby 2.7.

So, we have consensus to disable deprecation warnings by default.
Our design is intentionally minimum because we need this feature for Ruby 2=
.7.

We chosen `Warning.disable(:deprecated)` instead of
re-defining `Warning.warn` because avoiding string object generation.

Of course, we expect extension to this feature:
Ruby-level deprecation warning generation,
warnings other than deprecation, =

file-based restriction of warning generation, etc.
But this issue doesn't contain them.




-- =

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

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