Glenn Vanderburg

: Blog

infosyndicate
« 9 to 10 of 10 articles
Rule of Three ... Almost There!
Mon, 07 Jul 2003 (22:41) #

About an hour ago, I saw Rael Dornfest's musings on Python. As I read it, I thought to myself, "Sounds like Rael would really like Ruby," but didn't think any more about it.

But just now NNW updated Chad Fowler's blog, and I see that Chad thought exactly the same thing! Rael, if one more person had the same thought, I think you're bound to give Ruby a try.

(Of course, I'm not sure this is really that significant; after all, every language bigot always thinks, "Oh, <my favorite language> would be perfect for that!" at the least provocation. But I've seen Rael's Perl code, and he really does need to give Ruby a try. And the source to RubLog might be a great place to start. :-)

What were they thinking?
Thu, 12 Sep 2002 (21:26) #
I think Ruby is a much better language than Perl, but it's definitely true that the libraries aren't as mature. Here's a problem that has just annoyed me for the second time.

All of the creation methods for the Time class take similar arguments, exemplified here by the Time.local method:

  1. Time.local(year [, month, day, hour, min, sec, usec])

But the ParseDate::parsedate method that does a good job of parsing date information out of human-readable strings returns this array:

  1. [year, mon, mday, hour, min, sec, zone, wday]

You really should be able to type Time.local(*ParseDate::parsedate(timeString)) but you can't. You've got to chop the last two elements off the array first. That's not hard in Ruby, but still ...

So far as I know, there may already be a remedy for this in CVS. But there really ought to be a Time.parsedate(aString) method that does the right thing.