From: Anders Borch Date: 2003-07-04T21:15:41+09:00 Subject: Re: purpose of replace method Ian Macdonald wrote: > On Fri 04 Jul 2003 at 19:35:21 +0900, Kent Dahl wrote: > > >>For String#replace, this means that you can change a text you have >>spread to several places without doing a reassignment again. This can be >>handy if you have it a zillion places. (I.e. consider _one_ replace >>versus N assignments.) > > > Ah, I see. So: > > irb(main):001:0> foo = bar = "string" > => "string" > irb(main):002:0> foo = "new" > => "new" > irb(main):003:0> bar > => "string" > irb(main):004:0> foo = bar = "string" > => "string" > irb(main):005:0> foo.replace("new") > => "new" > irb(main):006:0> bar > => "new" > > OK, that makes sense. replace is useful when multiple pointers point to > the same object. > for this purpose it would be nice to have in Object. Why isn't there a replace method in Object? -- dc -e 4dd*od3*dddn1-89danrn10-dan3+ann6*dan*2*an13dn1+dn2-dn3+5*ddan2/9+an13nap