From: Tomas Pospisek's Mailing Lists Date: 2007-05-04T20:46:15+09:00 Subject: Re: RCR? On Fri, 4 May 2007, Yukihiro Matsumoto wrote: > In message "Re: RCR?" > on Fri, 4 May 2007 19:15:44 +0900, "Robert Dober" writes: > > |Currently I am writing lots of code like this: > | > |"some string".gsub(/s/,"") # I am using more complex rgxs therefore > |# String#delete is not an option. > | > |I would like to write > |"some string".gsub(/s/) > |instead. > | > |There are two roads to walk: > |(a) Allow String#delete to have a Regex > |(b) Give String#gsub, String#sub, String#gsub! and String#sub! the > |empty string as default for parameter replacement. > > Could you tell me why you want to reduce tiny three letters? > I feel like explicit empty replacement describes user's intention more > precisely than omitted default empty. > > How do you think comparing those two: > > "some string".gsub(/s/,"") > "some string".gsub(/s/) I must say that the latter looks quite intuitive to me: replace /s/ by ... um, well, nothing :-) *t -- ----------------------------------------------------------- Tomas Pospisek http://sourcepole.com - Linux & Open Source Solutions -----------------------------------------------------------