Paul Barry

Editing Files in Place with Ruby

October 3, 2007

One thing that’s interesting about Ruby is that you can blatantly see the influence of other languages such as Lisp, Smalltalk, Perl and Java in it. One thing I always used to use Perl for is a simple search and replace tool:

perl -pi -e 's/foo/bar/g' *.txt

I recently discovered that there is a similar equivalent with Ruby:

ruby -pi -e "gsub(/foo/, 'bar')" *.txt
Posted in Technology | Topics Ruby, Perl | 2 Comments

Is your language beautiful?

July 9, 2007

There is a good presentation posted over on by Glenn Vanderburg called The Beauty of Ruby. First of all, I like the format of the presentation on that site. You get the video of the speaker, but you can still see the slides below it.

I agree with all of his points about Ruby, which are all reasons why I’ve been doing all of my programming lately in Ruby. There’s a point he makes early on in the presentation that I think is probably very accurate. Most people who really give Ruby a try on a real project with an open mind will find that they love it. The key is that you must unlearn what you have learned. Some things that would be considered a bad idea in other languages turn out to be not a problem in Ruby, for one reason or another.

In this presentation, Glenn is careful to focus more on what he likes about Ruby, and less what he doesn’t like about other languages. But as is inevitable when discussing a language, there are comparisons to other languages. Perl gets the most criticisms, and Java some as well, but very little criticism of Python. Lisp and Smalltalk, as usual, get some love but some criticisms as well. So I’m wondering, is your language beautiful? What parts of your language do you consider to be beautiful, specifically when compared to Ruby?

Posted in Technology | Topics Python, Ruby, Perl