From: Glenn Parker Date: 2005-03-20T03:13:44+09:00 Subject: Re: strip and its evil brother strip! Florian Gross wrote: > > I tend to disagree as destructive methods are not supposed to be > chained. They are optimized forms when you would be doing a variable > assignment, IMHO. > > So they are optimizations for this case: > > a = a.strip > > But not for this case: > > puts a.strip Who (else) ever said destructive methods are not supposed to be chained? I'm thinking more of this somewhat contrived, but broken, case: words = gets.chomp!.strip!.downcase!.gsub!(/[^a-z]/, '').split(/ /) Unless and until object creation overhead is greatly reduced, this is a worthwhile idiom. -- Glenn Parker | glenn.parker-AT-comcast.net |