I was considering
this post about the expressiveness of the Ruby Date/Time functions, and was wondering if the same type of syntax could be duplicated in Scala. After about 20 minutes hacking around, here's what I came up with. I'm not sure I'm completely in love with the abstraction, but the method calls look the same.
Output:
2 weeks from now: Sat Jul 26 14:58:44 MST 2008
10 days from now: Tue Jul 22 14:58:44 MST 2008
5 minutes ago: Sat Jul 12 14:53:44 MST 2008
[ July 12, 2008: Message edited by: Garrett Rowe ]