From: Chad Perrin Date: 2007-07-15T14:10:44+09:00 Subject: Re: gets On Sun, Jul 15, 2007 at 08:40:10AM +0900, Robert Klemme wrote: > > With regard to premature optimization: I just made it a habit to use > chomp! in this case because I dislike creating an object that is > immediately thrown away when I can avoid it easily. I'm not religious > here - it's just my personal rule of thumb. As I said "inplace > modification" is nothing special, it's just the normal OO way of doing > things: object state changes. Maybe people tend to forget that String > and Fixnum are objects just like any other object (ok Fixnum is > immutable and immediate but that's about it) and maybe that's the reason > why they feel that inplace modification is special or bad. Dunno. Chad > mentioned issues that can arise in complex code from inplace > modification and took that as his personal guideline to avoid it. I > have a different personal guideline... My personal guideline is basically to avoid in-place modification unless I have specific reason to use it. I find that an approach more reminiscent of functional style lends itself to readability as well as technical benefits for complex code, generally -- and when it doesn't, that qualifies as "specific reason to use" in-place modification. I guess there's a sort of fuzzy area in the middle where one tends to lean one way or the other, based on personal preferences. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] Amazon.com interview candidate: "When C++ is your hammer, everything starts to look like your thumb."