From: "Chr. Rippel" Date: 2002-01-12T04:04:38+09:00 Subject: Re: class name reported differently in different contexts "ts" wrote in .... > Don't forget : if I've a classpath, I can retrieve the constant actually. > If I have only a classid, I can't retrieve the constant. So what you are saying is that you can do something like ------ begin class Klass def self.inherited(sub_klass) const_get sub_klass.inspect.sub(/^(Klass::)/, '').intern # before Nobu's patch it's even simpler - i.e. # const_get sub_klass.intern # this would be an argument of neither setting classid nor # classpath end class Sub < Klass;end end rescue NameError => mes puts mes # => uninitialized constant Sub at Klass end ------ > With this patch, classid is useless and even for "native" classes it can > exist only classpath. Yes, following the logic of this patch you might as well merge classid and classpath into one variable (as far as I understand it's implications). Playing the devils advocate there is actually some reason for setting classpath (and not classid) in the second form of class creation ------ module Outer klass = Class.new # if the this call is succesful the classpath of klass # is know and could already be set. end ------ It also seems plausible that there exist a situation where you would be in the position of rescuing an exception imminating from an #inherited call and it seems that the only way of correctly defining the corresponding class constant is that classid is already set before the call to #inherited - i.e. the previous behavior. /Christoph