From: akr@... Date: 2019-11-12T07:07:19+00:00 Subject: [ruby-core:95808] [Ruby master Feature#16345] Don't emit deprecation warnings by default. Issue #16345 has been reported by akr (Akira Tanaka). ---------------------------------------- Feature #16345: Don't emit deprecation warnings by default. https://bugs.ruby-lang.org/issues/16345 * 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 version. They are not useful when development for current Ruby. They are especially frustrated when deprecated warnings are generated in gems. 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=deprecated`) 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: