Project

General

Profile

Feature #11398

deprecate constants

Added by nobu (Nobuyoshi Nakada) over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:70142]

Description

Sometimes old constants are deprecated but still remained for backward compatibilities.
It is not noticed and will be kept forever, with no warnings, though.
So I propose a method Module#deprecate_constant to mark a constant obsolete and emit a warning message when it is referred.

https://github.com/nobu/ruby/tree/Module%23deprecate_constant


Related issues

Is duplicate of Ruby trunk - Feature #10342: Module#deprecate_constantClosedActions

Associated revisions

Revision 83cd51e3
Added by nobu (Nobuyoshi Nakada) over 3 years ago

variable.c: Module#deprecate_constant

  • variable.c (rb_const_get_0): warn deprecated constant reference.
  • variable.c (rb_mod_deprecate_constant): mark constants to be warned as deprecated. [Feature #11398]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 51444
Added by nobu (Nobuyoshi Nakada) over 3 years ago

variable.c: Module#deprecate_constant

  • variable.c (rb_const_get_0): warn deprecated constant reference.
  • variable.c (rb_mod_deprecate_constant): mark constants to be warned as deprecated. [Feature #11398]

Revision 51444
Added by nobu (Nobuyoshi Nakada) over 3 years ago

variable.c: Module#deprecate_constant

  • variable.c (rb_const_get_0): warn deprecated constant reference.
  • variable.c (rb_mod_deprecate_constant): mark constants to be warned as deprecated. [Feature #11398]

Revision 51444
Added by nobu (Nobuyoshi Nakada) over 3 years ago

variable.c: Module#deprecate_constant

  • variable.c (rb_const_get_0): warn deprecated constant reference.
  • variable.c (rb_mod_deprecate_constant): mark constants to be warned as deprecated. [Feature #11398]

Revision 51444
Added by nobu (Nobuyoshi Nakada) over 3 years ago

variable.c: Module#deprecate_constant

  • variable.c (rb_const_get_0): warn deprecated constant reference.
  • variable.c (rb_mod_deprecate_constant): mark constants to be warned as deprecated. [Feature #11398]

Revision 51444
Added by nobu (Nobuyoshi Nakada) over 3 years ago

variable.c: Module#deprecate_constant

  • variable.c (rb_const_get_0): warn deprecated constant reference.
  • variable.c (rb_mod_deprecate_constant): mark constants to be warned as deprecated. [Feature #11398]

History

Updated by matz (Yukihiro Matsumoto) over 3 years ago

It seems a good idea, for example, we have TimeoutError (instead of Timeout::Error).

Matz.

#2

Updated by nobu (Nobuyoshi Nakada) over 3 years ago

  • Status changed from Open to Closed

Applied in changeset r51444.


variable.c: Module#deprecate_constant

  • variable.c (rb_const_get_0): warn deprecated constant reference.
  • variable.c (rb_mod_deprecate_constant): mark constants to be warned as deprecated. [Feature #11398]
#3

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

Also available in: Atom PDF