"Bill Kelly" <billk / cts.com> writes: > From: "Bill Kelly" <billk / cts.com> > Subject: Re: RCR 296: Destructive methods return self > To: ruby-talk / ruby-lang.org (ruby-talk ML) > Date: Tue, 22 Mar 2005 15:40:31 +0900 > Reply-To: ruby-talk / ruby-lang.org > X-Mail-Count: 134623 > > From: "Hal Fulton" <hal9000 / hypermetrics.com> >> >> I would almost suggest what I once suggested as a joke: Combine the ! and ? >> suffixes. >> >> gsub! returns self >> gsub!? returns self or nil (yes, it looks silly) > > It looks a little silly, but it seems pretty straightforward > to read and understand: "Oh, it's gsub-bang with a question." > > The occasions when I've cared about the flag returned by the > bang methods has typically been associated with some conditional, > like: > > save(data) if data.gsub!?(/foo/, bar) > > I.e. the ? is not too far from the 'if' so maybe reduces its > silliness slightly by giving it something to relate to visually? :) I actually like that. :-) I think it's the best proposal of this thead (aside of leaving it as it is). Bonus points for using Interrobangs with -Ku. (http://en.wikipedia.org/wiki/Interrobang) ;-) > Doesn't seem too heinous to me. > > > Regards, > > Bill -- Christian Neukirchen <chneukirchen / gmail.com> http://chneukirchen.org