I like Ruby, but there are things that I've gotten used to in Perl. Little things. Things you don't think are such a big deal until they're taken away.
Take, for instance, each languages' implementation of GetoptLong. In Perl, the option specifiers are short and precise. In Ruby, they're rather long-winded. Also, Perl has plenty of config options, while Ruby has three: none, optional, mandatory.
Both languages assign the values to a hash...or do they? The Ruby GetoptLong class does not actually seem to be a subclass of Hash. It appears to be some bastard child of Hash, as it does not have all of the methods of the Hash class, while adding some custom methods of its own.
Ruby lacks the convenience I'm used to. For example, if I want to use a debug-print statement in Perl, I could simply do:
Oh, and one other thing. The ability to omit quotes in hash keys is something you don't miss until you're forced to do it in another language. Man, that gets annoying *fast*. I seem to recall that feature was added on a lark to facilitate Perl poetry (though perhaps that's a Perl 'urban legend'). Whatever the reason, thank you Larry for adding that!
Of course, it's very possible that I've totally missed something with regards to Ruby's GetoptLong. In any case, I think this is one instance where maturity trumps design.
PS - There is no GetoptStd in Ruby. Perhaps Matz felt it was redundant. :\
Re:Immaturity
ziggy on 2002-04-12T20:00:04
Hypothetically speaking, if there were an environment where something like CPAN were to exist, regardless of the language you were using (Perl, Perl6, Python, Ruby, Lua, etc.), would that make you more likely to switch to a new language?Re:Immaturity
Matts on 2002-04-12T23:31:23
Yes [*]. CPAN makes my job easier. It makes me look smarter and more productive for knowing about it.
RAA (Ruby Application Archive) is almost there, it's just not automated in the same way.
[*] The point being that Perl is a PITA for some things. Especially OO. And I like OO. I just don't like the whole "my $self = shift" crap that goes with it in perl. Every new OO module I write I feel like I'm re-inventing the OO wheel. Oh, and Perl is dying according to Simon, so I'm getting ready to jump ship.
Or with
Getopt::constant, just
D && print "Debug print\n";
And since it's a constant, there's compile-time constant folding!
Re:gratuitous plug for Getopt::constant
djberg96 on 2002-04-12T20:35:47
Oh, hey, cool. Guess I've never sprinkled enough debug print statements in a script to warrant this, but it's nice to know for other reasons as well. Thanks.:)