From: dblack@... Date: 2002-12-09T12:29:50+09:00 Subject: Re: [YANQ] -yet another (ruby) newbie question -string#concat Hi -- On Mon, 9 Dec 2002, Mike Campbell wrote: > > > String#concat is a synonym for String#<<, and since it modifies the > > object, a concat! version wouldn't make sense. You can indeed use > > String#+ if you want to create a new string instead of modifying the > > old one. > > To be fair here, it might be argued that the String#concat alias is > misnamed and *IT* doesn't make sense, given what it does. Seems to > me (and I'm guessing Botp) that the alias SHOULD be String#concat!. Not every method that modifies the receiver has a ! -- for example, String#replace. (If there were a replace!, then the original replace would just be dup :-) I guess to me 'concat' has the same inherently change-rendering implication that 'replace' does; it sounds like an order is being issued that something be done to the object. By way of (merely illustrative) contrast: if there were a method String#concatted_with(other_string) I would expect that to generate a new object. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav