From: David Alan Black Date: 2001-12-30T06:39:15+09:00 Subject: [ruby-talk:29654] Re: promoting self to subclass (was extending method of class A ...) Hello -- On Sat, 29 Dec 2001, Mark Hahn wrote: > Why not allow a method to "promote" it's object to a subclass of the object? > I've wanted to do this before in ruby and Java. It should be somewhat easy > in ruby and nearly impossible in a static language. [...] > Where I've run into this need is when an initializer realizes that, based on > input params, there is a more specific class for this data. Another case is > when an object is created and the "type" gets refined later. If you want a > specific example of this being used, let me know. Yes, please :-) I'm also wondering whether this is similar to the idea of a #become method. There's been a bunch of discussion on that here in the past. In particular, see the thread starting at: "[ruby-talk:19517] Why not?: Assigning to self" David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav