From: dblack@... Date: 2002-12-09T13:03:38+09:00 Subject: Re: [YANQ] -yet another (ruby) newbie question -string#concat Hi -- On Mon, 9 Dec 2002, [iso-8859-1] "Pe�a, Botp" wrote: > Hi sir David (aka dblack@candle.superlink.net > [mailto:dblack@candle.superlink.net]): > > You remarked last Monday, December 09, 2002 11:30 AM: > > > 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 > > Then #replace method is another thing I would avoid since the syntax/naming > has implications or assumptions. Syntax/Naming should be unambiguous as much > as possible, imho... Why can we not standardize on suffixing "!" on methods > that modifies objects? Are they too many? Though, this is not a big problem > for me really, as of now, since I'm actually avoiding them.. :-) Hmmm.... I wish I could figure out how to talk you out of that. I think you're investing the concept of object-modification with much more complexity than it has. As for having all destructive/modifying methods use !: we'd end up with an awful lot of !'s in our code :-) a = [1,2,3,4] a.push!(5) # and a.push(5) would create a dup of a??? a[-1]! = 6 # as in: a.[]=!(-1,6) a.delete_if! {|x| x == 3} etc., etc.... There's a lot of previous discussion on this (the general ! question, not concat specifically). I searched for "destructive modify receiver" on ruby-talk and hit a few such threads. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav