Project

General

Profile

Bug #12382

Updated by nobu (Nobuyoshi Nakada) about 4 years ago

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. 

Back