So: after months of tip-toeing around it, last night I sat down and tried converting a small toy app previously written in another language to Ruby, a kind of Ruby trial by fire. Considering the circumstances, it went fairly well. However, I’m left wondering some things. (Readers not intimately familiar with my programming situation: loving Objective-C, liking Perl, using PHP and getting by with it, not touching Python with a stick (out of bad experiences with it, not because of tribal dogma).)
The documentation is fine. However, the Book’s HTML version (the only one at hand) keeps referring to itself in terms of page numbers only printed in the dead tree version (which by implication is not at hand). Jumping around is guesswork, and I suppose it wouldn’t be so bad if the pure API documentation was also guilty of referencing the rest of the book in the same way in some places. You can point out weaknesses in PHP all day, but the PHP manual is comprehensive, well-structured, searchable and downloadable, and even the manual’s discussion parts (“discussion” meaning those not directly saying “this class does that and this method does this” but discussing the material in a wider context, not the user-added comments) have these blue linky things in them that you can click.
Threads: awesome. No concurrent threads: whuh?
Regular expressions: good that they’re built in. However, I poopoo its seeming unability to return an iterator of a standard array of matches when you know you have a string with multiple matches in. scan is close but doesn’t return the entire match (\0) in its array (matches) of arrays (groups). Update a few days later: fix.
This experiment has strengthened my small experience and general hunch of Ruby: it’s good in the ways that Perl is good, and it’s conventional in the ways that Perl is not conventional (everything is an object! sane OO model! iterators!), but its principle of least surprise introduces bigger surprises: things are less than useful in some common scenarios (threads and concurrency, regexes and multiple matches) simply because they simplify or deviate from the norm.
Don’t get me wrong – I love it because it’s simple, and deviating from the norm doesn’t automatically mean doing it worse. The two together have certainly already meant dynamite for Ruby in many places. I think I’ll keep using Ruby for some stuff, but it’s not all sunshine.