From: "T. Onoma" Date: 2003-12-14T16:27:50+09:00 Subject: Re: inplace assignment On Sunday 14 December 2003 07:49 am, Hal Fulton wrote: > 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? Well, the reason its a constant is b/c its a class. It's funny how things come up. I only recently learned that when you modify a class, all previously defined objects of that class are effected. But what if you want to pull the entire "rug out", so to speak, and replace a class with a "duck similiar" class? Okay, so it's a bit crazy. But I actually came across a use for this. Luckly my situation is specialized --I am replacing the class with a subclass of it, so I discovered that I could just do this: class MyClass < MyClass (and now that I think about it I can probably do this for any calss) it seems to work fine. but now i'm running into an disturbing problem. next post... -- T.