I don't mean this to be a exhaustive list of differences, a detailed technical comparison, or an introduction of Ruby for Perl programmers. Just a gathering of thoughts that I feel the need to share.
Ruby seems to escape this criticism, and yet it can be every bit as ugly. A lack of curly braces around definitions takes some getting used to, and it makes a poorly indented application hard to read at a glance.
Another big departure was in the lack of line separators (;), or perhaps I should instead say that they're optional. While I can see the argument that this forces readability via-a-vie a one line, one statement structure, the fact that line separators can be used removes this benefit.
Lesson: You can make Ruby every bit as messy as Perl if you want to.
Ruby, on the other hand, is OO from the ground up, making it more friendly to the Java trained OO programmer. Or at least to this one. Ruby takes it a step further though, and does away with primitive types, and the result is some very clever infrastructure. An array variable, for example, is an instance of the Array object, and contains useful methods for working with the array; iterators, for example. Hashes work similarly.
From this Perl programmer's perspective, it takes some getting used to. Instinctively one wants to write
rather thanforeach my $member @array { ... }
Then again, that's a habit that one learns to change. Which brings me to the next item.array.each { ... }
Ruby doesn't use this convention, and boy did I miss it. The @ character makes an appearance to signify a class an instance variable, and two of them together (@@) make a class variable, but that's it. The fact that hashes and arrays are both indexed using square brackets ([]) contributes to the confusion. It's good that these elements are present, but it's a potential pitfall, and again, it takes some getting used to.
Also, it helps you appreciate one of the ways that Perl is more readable than its counterpart.
This is, I think, a reflection of the relative maturity of Perl to Ruby. With a decades long an eight year head-start, Perl has grown a community of developers; many of whom have been willing and eager to post the best of their libraries for others to use. It's those same developers that can lend their time and expertise to those of us who might not know any better. Ruby has neither of these things because it hasn't been around long enough. Given another decade, that may change.
That said, I've always believed that the strength of any organization is in its people. Perl provides the model of a development community that other languages strive for, and as a result, when I'm presented with a task that seems unusual, awkward, or that requires fitting the square peg in the triangular hole, Perl will continue to be the natural choice.
--starX
www.axisoftime.com
In reply to Ruby Before Perl? Nah. by starX
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |