The second language covered in Seven Languages in Seven Weeks is Io. If you’re like me and enjoy Googling for help learning a new language, this one is tough. The only real sources of information about Io seem to be the official website and answers to the questions raised in this very book. As of this writing, there’s only 39 questions tagged with “iolanguage” on StackOverflow (compare to Ruby’s 71,477).
One thing I struggled a bit with is that most commands in Io read backwards compared to what I’m used to from other languages, but not always.
# PHP<br />
print "Hello, World!";<br />
echo "Hello, World!";
# Io<br />
"Hello, World!" print<br />
write "Hello, World!"
In the first example, Io is sending the message print to the sequence “Hello, World” while, in the second example, the sequence is being passed to the write method as an argument. Loop constructs also can work from both sides.
# 0..9<br />
for (i, 0, 9, i println)<br />
10 repeat (i, i println)
Tate does spend a section talking about how Io is powerful when building a domain-specific language. Like Ruby, Io let’s you replace any built in functionality with new versions. For example, in one of the daily lessons, the book has you replace the built in division operator (“/”) with one that returns zero if the divisor is zero.
Overall, I felt that the real meat of this section was in the first lesson, while the other days were merely code exercises. I found this section severely lacking compared to the one on Ruby, which is Tate’s “native” language. I won’t know if that is a criticism of the book or just this section until I finish the next.