Io – Prototypes for ordinary people

By: on December 7, 2005

Some programming languages look like they were designed especially to secure their authors a place on LtU – sort of 15 minutes of fame for language mavens. That’s not the case with Io, although it does sport some neat features that are not common enough in today’s language universe (and it did make it to LtU, which is how i found out about it).

Io is a small, dead simple dynamic language. It’s most important characteristic is it being a prototype-based pure object-oriented language. Unlike many popular OO languages, Io lacks any data types that aren’t objects – that includes classes, which are common as a generalisation mechanism in other languages, but are dangerous because they pollute a language with an entity that is above the normal object space and often make it much less intuitive to reason about OO design and to interact with live systems. Instead, in prototype languages like Io (and like [old link: http://research.sun.com/self/language.html” new link http://c2.com/cgi/wiki?SelfLanguage] Self, the ancestor of all prototype languages, Javascript and Slate, to mention a few) new objects are created by cloning existing ones. Cloning does not really copy an entire object, it only creates a pointer to the original object, the prototype, and stores any changes to the new object later on, if and when it’s modified.

As I mentioned, Io is not the only prototype language out there, but it is unique in being a very simple, geared towards down to earth programmers in need of a powerful tool. It is not a grand research project, a new operating system replacement or a domain-specific extension. Io is a ‘scripting’ language, in the same sense that Python, Perl and Ruby are. It is extremely dynamic and introspective, allowing the program to inspect and change any of its components in runtime, and is running on top of a simple virtual machine written in portable C. In addition, Io is very easy to learn, thanks to the almost complete lack of special syntax (in Io even assignment is achieved by passing a message to an object).

After i found that the SGML parser bundled with Io is not good enough (the current distribution comes with a generous collection of libraries, though quality and maturity vary), I have decided to try and build bindings for Gnome’s libxml. Libxml comes with XML definitions of its entire public interface, and using a bit of XSLT i transformed them into Io code, which looks very much like LISP S-Expressions (sure, I would have loved to use Io itself for the task, but the lack of working XML facilities was an obstacle, of course). This is where the problems began. Libxml is rather big, and I found, to my great disapopintment that the version of Io I have cannot parse the entire generated program, running into some artificial memory limitations before completion. I was even more surprised to find out that not only could I not configure this parameter in either run or build time, but that the magic number I wanted to control was hard-coded (not even using a define) and buried deep in the source.

After many attempts (and many more similar problems) I have discovered Io’s DynLib object – a useful little object that allows you to bind to shared C libraries in run time, and I am now directing my efforts in this direction. After finally being able to get some basic results, yesterday’s so-called stable release rendered my experiments useless again. Languages in development are indeed a moving target, but this contrasts with the claim of the language designer’s to have a 1.0 release baking, out by the end of the year.

In conclusion, Io is a wonderful little language, and I think it has a great potential in same niche occupied today by other ‘scripting’ languages. I sure do hope to be working more with it in the future. However, judging by the current state of the codebase and the amount of changes the language and its basic libraries have taken even in the very short time I’ve been watching the development, we are still far away from a 1.0 release.

FacebookTwitterGoogle+

Comment

  1. Without diminishing from Io’s elegant design and solid set of features, I’ve found Lua to a great little scripting language with powerful and easy to use C binding and enough available libraries (and code examples) to get you rolling pretty fast. It also supports OO prototyping which indeed turns out to be pretty fun to work with and much more flexible than the what you get with static OO languages. What Lua still lacks however is a convenient macro facility (a la Lisp/Scheme). But with the active community it has we might be getting it someday.

Post a comment

Your email address will not be published.

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>