Michel Martens wrote:

> Hi, David. I know how it works now, that's why it's a proposal. The
> idea would be to modify the language to allow that kind of
> manipulation. Then, the following methods would be allowed:
> 
> a = 'hello world'  # String
> a.replace(/\w+/)  # Regexp
> a.replace(35)  # Fixnum
> a.replace(SomeClass.new)  # SomeClass
> 
> And then you would be able to add methods like to_s! or to_i!, etcetera.

Something is usually wrong when you want an Object to change classes at 
run time. There's certain use cases for this, but at large it's related 
to confusing variables with Objects.

E.g. if you expect the above to work you're likely to expect this:

a = /something/
b = a
a.replace "other"
a # => "other"
b # => /something/

But you can not have that. The last line will always result in "other" 
as well.

If you don't expect this and if you can live with quite some limitations 
  you should have a look at the Object#become that evil-ruby implements. 
(See evil.rubyforge.org)