From: Dave Thomas Date: 2004-06-26T00:57:06+09:00 Subject: Re: Is it considered Harmful? On Jun 25, 2004, at 10:48, Sean O'Dell wrote: >> If you think that the possiblity to crash ruby is not a technical >> reason, >> then you are right it don't exist solid technical reason. > > You're wrong on that. It wouldn't crash Ruby to change the class of an > object. Objects already change their class when you turn them into > singletons. > Changing it to any class of your choosing would be even simpler, > since creating a singleton involves inheriting all the old class > methods; > changing a class wouldn't require all that work. Singletons are effectively subclasses of the original. irb(main):001:0> a = /cat/ => /cat/ irb(main):002:0> def a.speak; "meiow"; end irb(main):005:0> a.speak => "meiow" irb(main):006:0> a.class => Regexp How would you handle a = /cat/ a.class = File a.read It's a brave man that calls Guy 'wrong,' so I'm looking forward to seeing your implementation of this. Cheers Dave