Project

General

Profile

Actions

Feature #22304

open

Add rb_warn_to_remove_at() for deprecation warnings shown by default

Feature #22304: Add rb_warn_to_remove_at() for deprecation warnings shown by default

Added by shugo (Shugo Maeda) 10 days ago. Updated 21 minutes ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:126656]

Description

Deprecations such as #22205 and #22276 are scheduled in phases: a warning shown only when Warning[:deprecated] is enabled, then a warning shown by default, then the removal.

For the first phase, rb_warn_deprecated_to_remove_at(X.Y, fmt, suggest, ...) (#17432) prints "... is deprecated and will be removed in Ruby X.Y", and a RUBY_DEBUG build fails to compile when the version reaches X.Y.

For the second phase, there is no equivalent API. A warning with the :deprecated category is suppressed by default by definition, so the warning must be emitted with rb_warn without a category, and the message and the version check have to be written by hand.

I propose to add rb_warn_to_remove_at(X.Y, fmt, suggest, ...) to internal/error.h: the same message and compile-time check, emitted with rb_warn. The name does not contain "deprecated" because rb_warn_deprecated* means a warning gated by Warning[:deprecated].


Related issues 2 (2 open0 closed)

Related to Ruby - Feature #22205: Deprecate ruby2_keywordsAssignedshugo (Shugo Maeda)Actions
Related to Ruby - Bug #22276: alias in a module falls back to Object even in classes not inheriting from ObjectAssignedshugo (Shugo Maeda)Actions
Actions

Also available in: PDF Atom