From: "Chr. Rippel" Date: 2002-01-12T01:04:27+09:00 Subject: Re: class name reported differently in different contexts "ts" wrote in .... > For me, this patch make classid useless but it's not remove it. From the point of view of someone who is pretty much clueless about the inner workings of the interpreter it seems that classid and classpath are normally hidden variables used in computing the value of Class#to_s Class#inspect (short of overriding the ladder two methods) computed at most once during the lifetime of a class. Normally this happens when the interpreter for the first time sees the lines module Outer class Klass # body end end The other possibility is that you define module Outer klass = Klass = Class.new # at this point neither classid nor classpath # are set - i.e. # remove_const :Klass # p klass # => Class:0xa047208> klass.inspect # classid and classpath are computed once never to be changed again, # thus p klass # => Outer::Klass end Here is another illustration on how classid and classpath (don't quite) work (as one might expect;-) (2.0).instance_eval do class B; end p B # => Float::B def Float.inspect ; "no effect on B.inspect - i.e." end p type # => no effect on B.inspect - i.e. p B # => Float::B end IMO it would sort of make sense that neither classid nor classpath are set before the hook call to #inherited - i.e. the illustrative snippet class Base def self .inherited sub_klass puts "#{sub_klass} is inherited form #{self}" end class Sub < Base; end end would result in something like #=> is inherited form Base The previous half-baked solution of setting classid but not classpath seems like the worst of all possible choices to me. /Christoph