Oldies but goodies: an article on Io
Par Sébastien Pierre, vendredi 4 avril 2008 à 15:27 :: Langages :: #84 :: rss
The last few weeks have been an occasion for me to take a step back and think about some stuff (more to come soon
-- in this introspective process, I've tried to find an article about Io I wrote four years ago for an on-line magazine. It vanished off the net, but thanks to Wayback machine I managed to retrieve the full content !
It's still an interesting read (thought I would definitely be more precise on the language traits now), and I even found some stuff I didn't recall (like Io was originally design to be part of a visual environment, a la Self !). Here is the full copy...
Programming Month: Io
Mon, 12/20/2004 - 17:25.
"Dynamic languages" is a trendy term that tends to be used for programming languages that are flexible and fit well in an "agile" development environment. Behind the trend are some really interesting and poweful languages, of which Io is certainly an important one.
History, background, reasons for Io
Io first publicly appeared in 2002 as a small language that would mix aspects of Lua, Lisp, Smalltalk, among others. The original ambition was to use Io as a base for a fully visual programming language, like Self. Overview
Io belongs to the family of "interpreted" languages (like Perl or Python), where the code is not compiled but directly interpreted. As many "interpreted" languages, Io is also dynamic: a program can generate and interpret new code on the fly. Also, Io brings this trait a bit further by applying Lisp "code as data" model, and allows any Io program to access and manipulate itself as an in-memory object model. This of course, makes Io a reflexive language as well.
Concurrent programming is an emerging concern in many applications, and most notably user-interface and web applications. Io takes inspiration from Act1 and uses the notion of "actors". Halfway between threads and continuations, actors allow to easily program your concurrent applications, without the burden of traditional thread or process-based programming.
Being simple and clean is something that is apparent both in Io's syntax and its object model. The syntax is very readable, and looks like a well-done mix between Lisp and Smalltalk. Io's object model is based on prototypes. A prototype-based object model does not uses classes to represent generalization and specialization, instead specific objects are created and used as "models" or "prototypes" to create new objects. In this paradigm, objects are cloned from prototypes instead of being instantiated from a class.
The object model is message-based, which means that method calls and even variable accesses are made by sending dynamic messages, and are not "hard-wired" (like in C++ or Java). Also, the way Io objects respond to messages can be changed at runtime, which is typically a "dynamic" trait.
Last but not least, Io has a very small footprint and can be easily embedded in a C or C++ application. One of its most interesting feature in this regard is its Objective-C bridge, which allows an amazing degree of integration, where almost no glue code has to be written to be able to use your Objective-C objects in Io, and vice-versa.
Strengths
Io's primary strengths stems from its clean design: it is a language that can be rather quickly learnt as it has simple and consistent syntax, semantics and API. As Io has a small footprint, this makes it very suitable for embedding. Speed is another strength of Io. It can outperform many other interpreted languages, making it an ideal choice for intensive work.
Another strength of Io, which is also interesting from an embedding perspective, is that you can redefine almost any mechanism. Everything in Io syntax is converted to messages, which can be redefined at runtime. In this respect, you can virtually change anything to suit your needs.
Also, Io's solution for concurrent programming is attractive for Web applications and GUI scripting.
Weaknesses
Although Io has many interesting and modern features, it is still very young. It does not so far sport development tools such as documentation generator or code checker, and still have a few problems in the interpreter. However, as Io community will grow, and more code gets contributed, these "youth problems" should vanish.
Sample Program
@@BaseObject := Object clone do(
demo := method("Inheritance Demo")
)
Parser := BaseObject clone do( parse := method(line,
words := line split(" ")
words foreach(word, writeln(word))
words count
) )
filename := args at(0) if (args count < 1) then ( writeln("Enter a filename: ") filename := File standardInput readLine )
file := File clone openForReading(filename) while (line := file readLine, Parser parse(line)) file close@@
Commentaires
1. Le lundi 14 avril 2008 à 22:49, par 岡崎市 不動産
2. Le mardi 10 août 2010 à 09:45, par prom dress
3. Le mercredi 11 août 2010 à 11:53, par zaser
4. Le mercredi 11 août 2010 à 11:55, par zase
5. Le mardi 17 août 2010 à 07:36, par wholesale wedding dresses
6. Le lundi 23 août 2010 à 07:58, par cosplay
7. Le mardi 24 août 2010 à 09:34, par coach outlet
8. Le mardi 24 août 2010 à 14:42, par timberland shoe company
Ajouter un commentaire