From: "Mauricio Fernández" Date: 2003-02-02T01:30:17+09:00 Subject: Re: 2 classes, same name On Sat, Feb 01, 2003 at 11:06:00PM +0900, Tom Sawyer wrote: > On Saturday 01 February 2003 06:12 am, Mauricio Fern�ndez wrote: > > > Errr, no? > > > > batsman@tux-chan:/tmp$ ruby e.rb > > X2 > > X1 > > Kernel > > XX > > 538072192 > > > > X1 > > Kernel > > XX > > 538071272 > > > > XX: 538072512 > > yes there are three different classes. just that they all have identical > reponses from #class, which i thought was interesting. It's not an identical response, but a Class value that is printed the same way :) It happens all the time in irb. Perhaps we should fix Class#inspect and/or Class.to_s . batsman@tux-chan:/tmp$ cat e.rb module X1 end module X2 end class XX def XX.record(*mods) x = XX.clone x.class_eval { include *mods } return x end def initialize puts self.class.included_modules puts self.class puts self.class.id puts end def XX.inspect "" end def XX.to_s "" end end xx = XX.record(X1, X2).new yy = XX.record(X1).new puts "XX: #{XX.id}" batsman@tux-chan:/tmp$ ruby e.rb X2 X1 Kernel 538072072 X1 Kernel 538070822 XX: 538072512 -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com Software is like sex; it's better when it's free. -- Linus Torvalds