This could possibly be one of the best Christmas’s ever, as Ruby 1.9 is slated to be released in the near future with a host of new features and performance improvements.
The performance improvements are extremely impressive and will be a huge boost to Rails applications – I am really looking forward to them. Not only will your Rails apps load faster, but they’ll take up less CPU resources on your system, which means less servers for large applications, meaning big cost savings and less headaches. For smaller apps, your server will be able to do more before you need to add a second, or can host more apps.
It won’t be an easy migration though: Ruby 1.9’s features include many things that will break the Rails framework and Rails apps. Here are just a few that caught my eye:
#sendwill no longer ignores visibility (i.e. private methods), you must use#send!. (Of course, you could re-define#sendto call#send!.)- Class variables are no longer inherited.
Hash#to_sreturns something more intelligible, but breaks anyone relying on the current behavior of mashing all the key-value pairs together.Hash#eachnow passes a two-element array.?cno longer returns the ASCII value forc, but instead the single-byte string"c"(you must useString#ordto get the ASCII value). Behavior forString#[]andString#[]=changed similarly, so"foo"[1] == ?owill still returntrue.- String is no longer an Enumerable, so
String#eachhas been removed (useString#each_charinstead).
But, there are many, many benefits. A lot of the improvements Rails made to Ruby through its “core extensions” library have landed in Ruby 1.9 (my favorite: the Symbol#to_proc implementation is in). Rails 1.9 has real character encoding support, more meta-programming methods, and plenty of other cool wizardry. Check out those new features for yourself.




Leave a Reply