From: nagachika00@... Date: 2016-06-15T15:40:14+00:00 Subject: [ruby-core:76039] [Ruby trunk Bug#12382] Deprecated constants will not print out warning when accessed directly Issue #12382 has been updated by Tomoyuki Chikanaga. Backport changed from 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED to 2.1: DONTNEED, 2.2: DONTNEED, 2.3: DONE ruby_2_3 r55425 merged revision(s) 55005. ---------------------------------------- Bug #12382: Deprecated constants will not print out warning when accessed directly https://bugs.ruby-lang.org/issues/12382#change-59242 * Author: Jan Lelis * Status: Closed * Priority: Normal * Assignee: * ruby -v: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux] * Backport: 2.1: DONTNEED, 2.2: DONTNEED, 2.3: DONE ---------------------------------------- Hi, the current behavior of `deprecate_constant` is a little confusing: ```ruby module Namespace module Deprecated end deprecate_constant :Deprecated end puts "Referenced access:" Namespace::Deprecated # warning: constant Namespace::Deprecated is deprecated puts puts "Direct access (from Object):" include Namespace Deprecated # warning: constant ::Deprecated is deprecated puts puts "Direct access (from inside namespace):" module Namespace Deprecated # no warning end ``` I would also expect a warning in the third case. -- https://bugs.ruby-lang.org/ Unsubscribe: