From: Marko Schulz Date: 2001-04-28T19:51:23+09:00 Subject: [ruby-talk:14373] Re: how change instances class On Fri, Apr 27, 2001 at 03:20:06AM +0900, Henning VON ROSEN wrote: > > (1) How(if possible) can I change the value of the class attribute? > > Say, that a instance at first is known as belonging to a fairly general > class, and when we gather more information, it turns out to belong more > precisely to a subclass. > > Is this part of Ruby 'as is', or do I have to extend. Point is to > keep instance id, while the knowledge of which class it belongs to > changes. Since many objectoriented languages don't allow to change the class an object is an instance of, there is a special pattern for this: Role Object (http://www.riehle.org/papers/1997/plop-1997-role-object.html) Nonetheless it would be interesting to have this in a language, though I fear it introduces to much trouble. You said this is possible in python. Do you know of the consequences there? Is it only possible or also a widely embraced practice? -- marko schulz Dieser Satz beinhalten drei Fehller.