From: Hal Fulton Date: 2003-12-14T15:49:07+09:00 Subject: Re: inplace assignment T. Onoma wrote: > > Sure, > > q = 1 > p q.__id__ # => 3 > q = 2 > p q.__id__ # => 5 (want this to still be 3) > > In other words I want to change what q "contains" rather then alter its > reference. With an array for example you can do that with #replace. In > particular I'm interesed in doing this with constants. > OK, I thought that was what you meant. String also has a replace. But there's no general Object#replace. My impression is that this in impossible in general, and for immediate values such as Fixnums, "even more impossible." The idea of doing this with a constant is scary to me. It's bad enough that a constant String or Array can be changed. And it's even scarier to think of doing that with something like a Fixnum. What's the situation where you'd want to do this? Hal