PLACE
languages
RPN in Io

Io

Io is created in 2002, blending ideas from Smalltalk, Self, Lisp, Lua, and other languages. It is dynamically typed, purely object-oriented (all values are objects) with a prototype-based model of object orientation: new objects are created by cloning, inheritance is achieved by sharing between the new object and its parent. The implementation makes use of a small and portable virtual machine. Multiple VMs can run in the same application. A program in Io can inspect and modify itself at run-time.

Basic data constructs in Io are lists, strings (called sequences in the language), ranges, and objects. Of course, lists etc. considered primitives are themselves objects. The very general and flexible object model of the language makes it possible to create many other data structures straightforwardly.

Procedures are values (and therefore objects) in Io, there being two kinds of them: methods and blocks. Blocks have lexical scope, while methods have dynamic scope, the latter meaning that bindings of non-local names are looked up in the context of the target object for the message that invokes a method. Otherwise methods and blocks are identical. In particular, both are dynamically created, anonymous values that occasionally get named, can be passed as arguments to, or returned from blocks and methods, can be inspected etc.

Similarly to Smalltalk, Io's execution-sequencing control constructs are implemented as methods. For example, for conditional execution and branching, analogous to the if and if-else statements in other languages, the if method can be called in the forms if (condition,then-action) and if (condition,then-action,else-action). Smalltalk's ifTrue and ifFalse methods are also implemented. Exception handling, too, is expressed in terms of methods and message passing: there are try, raise and catch, similar in use to other languages, but in Io these are methods instead of special constructs.

Io provides support for parallel programming, with a concurrency model based on the concepts of actors and futures, and built on co-routines and asynchronous I/O.

Networking is supported through socket-based communication. To facilitate Internet programming, the language has an XML parser implemented as a standard library feature.

External code can be used with Io, and there are bindings for some multi-platform program libraries, e.g. OpenGL and FreeType.

Io's documentation is only available online from the home page of the language (see below), but currently (as of 2007) it is rather scant, and for a lot of topics outright missing.

Being simple and flexible, and having a rather compact implementation, Io is considered well suited for both stand-alone and embedded scripting. However, performance is not a major design goal of the language, and it can be significantly slower than other scripting languages, such as Perl, PHP, Python and Ruby, let alone Lua and Euphoria.

Links of Relevance

The home page for Io

boykobbatgmaildotcom