From: matz@... (Yukihiro Matsumoto) Date: 2000-06-14T16:35:50+09:00 Subject: [ruby-talk:03388] Re: chomp! Hi, In message "[ruby-talk:03384] Re: chomp!" on 00/06/13, Dave Thomas writes: |> By the way, do you prefer the behavior like: |> |> str = $_.dup |> if str.chomp! |> $_ = str |> end | |Even better would be an implementation (in C) like: | | if $_.chomp? | str = $_.dup.chomp! | end | |where chomp? did the initial setup for the chomp, and returned true if |the string would be modified, and then chomp! could use that work to |change the string. This requires you have to update your document. Is this OK for you? |On performance tests I've been doing, string object creations are a |BAD THING, so eliminating that dup would be good. Well, I'll try. But dup removal for chomp/gsub/sub is kinda hard. matz.