Mr eel

Why I Like Ruby Pt.1

Ok, well I’m actually a Ruby newbie, but I’m finding an awful lot to like about the language. Firstly I totally dig object-oriented interpreted languages — like loverly Javascript — because they encourage experimentation in learning i.e. change some code, run it to see if it works. I much prefer this compared to using compiled languages. I want to see my code run now!

But aside from my general love for interpreted languages, there are loads of really… really bloody sweet features in Ruby. Even simple stuff like assignment has it’s own special twist.

For example assignment:

	mum.last_name = dad.last_name = 'Sutton'
	mum.last_name	> 'Sutton'
	dad.last_name	> 'Sutton'

Or even more fancy, parallel assignment:

	a, b = 5, 9
	a > 5
	b > 9

Or how about comparing arrays?

	[1,2,3] == [1,2,3] > true
	[1,2,4] == [4,3,6] > false

Repetition in arrays:

	[1,2] * 3 > [1,2,1,3,1,2]

Basically Ruby gives you a lot for free. I’m so used to dealing with javascript, which has a rather… um, slim core, so I’m constantly delighted with all the fancy stuff. I’m also really pleased to see that the language has been designed really well, so that certain methods are available to most classes and they work in a consistent way. For example the each() iterator used in hashes and arrays.

*Sob* I luv you Ruby!

Posted on July 26th, 2005 | There are 0 comments

Comments

Add a comment

All contents © 2005—2007 Luke Matthew Sutton