After I had some fun with the Ruby exercises, week 2 brings a language that’s new to me. Or at least it was new to me as I started reading about the Io language about half a year ago. Like I wrote in the introduction post I spent some more time with Io and came to write iospec, a small BDD-style test library that is inspired by Ruby’s RSpec.
The character Bruce chose to represent the Io language is Ferris Bueler. Let him take you for a day and you’re in for a real treat, and end up seeing things you’ve never considered before. Io uses normal order evaluation, meaning that it delays evaluation of method arguments until they are required (i.e. lazy evaluation).
Being a homoiconic language (meaning that program structure is, like data, represented in a primitive data structure of the language) Io offers lots of flexibility, making Io a great language for implementing DSLs. It’s this flexibility that made it possible to create the iospec test library. Io is almost like an object-oriented Lisp.
Io is relatively new with a small community. Development started in 2002 by Steve Dekorte, to help him better understand how interpreters work. It is inspired by Smalltalk, Self and Lisp. Io is used in different environments, like router configuration language and a scripting language for video games. Its small footprint, rich concurrency (it supports the actor model) and simple integration with C makes it highly suitable for embedded systems.
I loved spending time with Io, doing the exercises of the book and creating iospec. Unlike Ruby there are not much syntactic sugars, but because of its awesome flexibility adding some yourself is fairly simple.
My solutions to the more interesting exercises in the book are available in the 7-languages-in-7-weeks repository on my Github profile. These exercises include a Fibonacci sequence (both recursive and destructive), a two-dimensional array including transpose, and an XML builder DSL.
Now it’s time to move on with the next language: Prolog.