From: "David A. Black" Date: 2004-09-30T04:56:32+09:00 Subject: Re: Best name for "this method" ? Hi -- On Thu, 30 Sep 2004, trans. (T. Onoma) wrote: > On Wednesday 29 September 2004 05:24 am, Robert Klemme wrote: > > >> A::B() > > > > NoMethodError: undefined method `B' for A:Module > > from (irb):7 > > > > >> include A > > > > => Object > > > > >> B() > > > > NoMethodError: undefined method `B' for main:Object > > from (irb):9 > > > > I was waiting for this ;) See if you can break this one. > > class Object > def const_get(c) > self.class.const_get(c) > end > def const_set(c,v) > self.class.const_set(c,v) > end > end I've lost track of where this is going a bit, but here you seem to be making it look like non-module/class objects have constants: a = "" a.const_set("X",1) p a.const_get("X") # 1 not to mention: p String::X # 1 (i.e., indirect setting of a Class object's constant). David -- David A. Black dblack@wobblini.net