On Thursday 24 June 2004 17:23, rolo wrote: > > Sean O'Dell (sean / celsoft.com) wrote: > > > On Thursday 24 June 2004 16:15, rolo wrote: > > > > Hi > > > > > > > > obj.class = MyClass > > > > > > > > Is it harmful? > > > > > > irb(main):002:0> {}.class = Array > > > NoMethodError: undefined method `class=' for {}:Hash > > > from (irb):2 > > > irb(main):003:0> > > > > Even if there was a #class= for objects, it ranks up there with goto in > > limited usefulness. Yes, it can be useful, but if you're using it, > > you're probably being too clever. > > I knew it was evil, I think it should be norm. > > PS I know it is not allowed, but is it so for tech reasons? Good question. I am personally having trouble thinking of a good reason why a programmer couldn't change the class of an object. Except for possible problems when a different set of methods suddenly gets a set of instance variables it might not expect (buyer beware), it seems like we ought to be able to do that. I don't believe there's any solid technical block to doing this, is there? Sean O'Dell