From: Dossy Date: 2002-06-14T23:32:15+09:00 Subject: Re: UNIX pipes On 2002.06.14, David Douthitt wrote: > Ruby's gsub(pat, str) form never felt "right" - I kept wanting > s/pat1/pat2/ - and why not? I really am curious... > > Instead of: > > "My string".gsub(/My/, "His") > > ...why not? > > "My string".s/My/His/ Too much syntactic sugar will give you syntactic cavities. This might be possible (but not implemented, AFAIK): str = "My string".s /My/ /His/ But then, that's close enough to: str = "My string".gsub /My/ "His" I do wish that the more natural s/pat/pat/mod syntax could be used in Ruby, but it's not a big deal. -- Dossy -- Dossy Shiobara mail: dossy@panoptic.com Panoptic Computer Network web: http://www.panoptic.com/ "He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on." (p. 70)