Over a million developers have joined DZone.
Platinum Partner

Day 2 - Io

· Java Zone

The Java Zone is brought to you in partnership with ZeroTurnaround. Discover how you can skip the build and redeploy process by using JRebel by ZeroTurnaround.

Io is the 2nd language in Bruce Tate's Seven Languages in Seven Weeks. Io is a prototyping language, where most of the mass exists in the libraries. The syntax itself is refreshingly simple, and he is not exaggerating to say you can grasp it in about 15 minutes.

As with the other languages he discusses, there's no download/install information save for the Io site URL. I did need a little help getting past this stage; if you click the only "download" link at http://iolanguage.com, you'll get a zipped distribution of the Io source. If you're smart enough to append "/downloads" to the URL (there's no link to this from the home page!), you'll find (in my case, Windows) binaries to spare you the build process (I wasn't smart enough to figure this out; I found another website which pointed me to http://iolanguage.com/downloads.)

Day 1 of Bruce's discussion of Io gets you familiar with the Io interpreter and the process of cloning. You learn about the "slots" of an object, which are basically the attributes and behavior. He then covers Io's lists and collections (specifically, List and Map). I was a little surprised to get different results than Bruce did (e.g. sending the asObject message to a Map clone returns Exception: Map does not respond to 'asObject', whereas in Bruce's output it returns an Object , though the version of Io I'm using appears to be old enough that it certainly should be the same as Bruce's). He then discusses true, false, nil and singletons, the last of which you create by overriding an Object's clone method. The ability to override even core methods is a key to Io's potential for creating domain-specific languages.

He finishes the "day" with an interview with Steve Dekorte, the inventor of Io, asking him about his motivations to create the language. I really like these interviews, as they give a (usually unavailable) view into the mind behind and motivations for the existence of a language. Language developers tend to be quite articulate when describing their motivations for creating a language; how often does anyone ask them?

Day 2 covers conditionals and loops, operators and messages, as well as message reflection and object reflection. Day 3 starts with a discussion of a non-trivial example of a domain-specific language, then discusses changing the language's behavior, by modifying Io's forward method (analogous to the discuss of Ruby's method_missing yesterday).

Bruce spends the rest of the day discussing Io's support for concurrency (as a longtime Java developer, alternative-language concurrency support is the number-one reason I am reading this book). He describes coroutines and contrasts them with pre-emptive multi-tasking in Java and C, then describes Io actors and contrasts them with threads, and shows how easy it is to make an object an actor. Concluding the concurrency segment is a discussion of Io futures.

As with Ruby on Day 1, Bruce ends the discussion of Io with a list of strengths and weaknesses, and as with Ruby, he puts a lot of thought into this discussion. I'll repeat that I am only scratching the surface by covering this "week" in one day (while recognizing that even one week would be scratching the surface), but I really appreciate the compactness of these segments and the density of information contained in them. 

From http://wayne-adams.blogspot.com/2011/03/day-2-io.html

The Java Zone is brought to you in partnership with ZeroTurnaround. Discover how you can skip the build and redeploy process by using JRebel by ZeroTurnaround.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}