From: Dave Bass Date: 2008-06-06T00:00:51+09:00 Subject: Re: A crosspost from the Perl Community Coming to Ruby recently from Perl, these are my comments. Star Cross wrote: > 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*. All languages are different. You soon get used to it! From someone who cut his teeth on Fortran IV, Ruby's layout doesn't look too bad. > 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, Ruby is much more OO than Perl. I started with Perl 4.036, which had no objects, then Perl 5 really had OO kludged onto it in a nasty way. In Ruby, everything is OO. (This is much nicer than Java, which I've also used.) > Perl programmers have got used to being able to tell what they're > looking at at a glance. $scalar, @array, %hash are all great ways of > being able to figure out what sort of data you're working with at the > moment. Ruby has a different model. In Ruby, variables are *references* to objects. So an array variable is the same as a hash variable etc: they're all just references to objects. In Perl, references are all $ variables, so it's no different really. (One can easily devise a naming system to help you remember what everything is, if necessary.) You can get bitten by this. Everything is call-by-reference, not call-by-value as in Perl, C etc. Change a function's parameter and you change the original, not a local copy of it. > The fact > that hashes and arrays are both indexed using square brackets ([]) > contributes to the confusion. No, they're both arrays; it's just a question of whether they're ordered and indexed by integers (like Perl arrays), or unordered and indexed by whatever you like (like Perl hashes). The square brackets consistently denote indexing. > Also, it helps you appreciate one of the ways that Perl is more readable > than its counterpart. I find the contrary. Uncommented Perl is typically impossible to understand unless you wrote it yourself. It *is* possible to write clear Perl but, as with C, most people don't bother. > Ruby has test/unit. Much much better than anything I've used in Perl. Test/unit makes test-driven development a breeze. Best thing since sliced bread! > That said, I've always believed that the strength of any organization is > in its people. It's the language I'm interested in, not the people. That's why I went into engineering rather than social work or politics! ;-) -- Posted via http://www.ruby-forum.com/.