Mighty Nice Lessons From ChicagoRuby Hack Night

Ruby 1.9Last night I attended a ChicagoRuby Hack Night. It was my first one, and well worth going to. The topic was Ruby 1.9 and how it differs from 1.8. The format was very casual. There was a written introduction to 1.9, and attendees randomly paired up to explore the intro on their laptop’s irb command line. It was a good opportunity to meet like-minded people and geek out on some cool new language features. Here’s what I learned about Ruby 1.9 at the ChicagoRuby Hack Night:

  • Varargs can now appear anywhere in a method definition
  • Block parameters are now like method parameters: they can have default args and varargs
  • Since symbols-as-keys hashes are so common in Ruby there is now a concise way of writing it. { :a => 1, :b => 2} can now just be { a: 1, b: 2 } (hash literals).
  • Hashes now retain creation order. I’m mixed on this. A classic hash algorithm won’t maintain order for the sake of speed. If you want order, use an array. I feel like Ruby is blurring the lines here, much like it does with the distinction between arrays and linked lists in the Array class. However, hashes are used so frequently in Ruby that this is a welcomed feature.
  • The Fiber library introduces a lighter-than-light-weight-threads way of doing concurrency. Granted you have to schedule the concurrency yourself, so you better know what you’re doing, but in simple cases this can be an improvement over firing off Threads.
  • The CSV library is now FasterCSV. I currently use FasterCSV as a gem. The less gems I have to worry about the better.

Cool stuff, and I’m excited to use it in production. Now I just need to upgrade!

By the way, since I haven’t upgraded my system Ruby yet I played with 1.9 via the Ruby Version Manager (RVM), an easy to use command line tool that allows you to keep different versions of Ruby on your box and switch between them with ease. It works great!

Mighty Nice Mightyvites are proudly powered by Ruby and Ruby On Rails

Incoming search terms:

  • chicago ruby hack night
  • night vites
  • owd hacknight blog
  • nite vites re
  • nice lessons
  • lessons of how to use command prompt to hack
  • Lesson to be a mighty hacker
  • how to use command prompt to hack
  • hack lessons website
  • command line ruby hack

Leave a Reply