From: Gavin Sinclair Date: 2004-06-28T15:03:03+09:00 Subject: Re: Is it considered Harmful? Sean O'Dell wrote: >> I don't even know what >> >> x = X.new >> x.class = Y >> >> is supposed to mean. But I do understand the idea behind this: >> >> x = X.new >> y = Y.new >> x.become y > > That's funny, because the first one makes immediate sense to me, but I'm > not sure what the second one does. > > What happens when x becomes y? Methods are replaced? No, the object x points to is discarded and x points to y instead. Moreover, *every* pointer to x now becomes a pointer to y, making the statement a little more potent than x = y The only description of #become that ever made sense to me was "like String#replace or Array#replace, but more general". The only rationalisation for this feature that ever made sense to me was, as usual, provided by Jim Weirich, in this thread. That is, replacing a proxy with a "real" object. I'm pretty sure he was talking about #become, not #class=. Cheers, Gavin