World Library  
Flag as Inappropriate
Email this Article

Io (programming language)

Article Id: WHEBN0000323340
Reproduction Date:

Title: Io (programming language)  
Author: World Heritage Encyclopedia
Language: English
Subject: Ioke (programming language), Self (programming language), Prototype-based programming, MiniD, Lua (programming language)
Collection:
Publisher: World Heritage Encyclopedia
Publication
Date:
 

Io (programming language)

Io
Paradigm(s) object-oriented prototype-based
Designed by Steve Dekorte
Developer Steve Dekorte, Jonathan Wright, Jeremy Tregunna
Appeared in 2002
Typing discipline dynamic, strong
Major implementations Io Io.NET Acute
Influenced by Smalltalk, NewtonScript, Self, Lua, Lisp, Python, Act1
Influenced Ioke, Restricted Io, Fancy, Luna, Potion

Io is a pure object-oriented programming language inspired by Smalltalk, Self, Lua, Lisp, Act1, and NewtonScript.[1] Io has a prototype-based object model similar to the ones in Self and NewtonScript, eliminating the distinction between instance and Class (computer science). Like Smalltalk, everything is an object and it uses dynamic typing. Like Lisp, programs are just data trees. Io uses actors for concurrency.

Remarkable features of Io are its minimal size and openness to using external code resources. Io is executed by a small, portable virtual machine.

History

The language was created by Steve Dekorte around March 7, 2002, after trying to help a friend, Dru Nelson, with his language, Cel. He found out that he really didn't know much about how languages worked, and set out to write a tiny language to understand the problems better.

Philosophy

Io's goal is to explore conceptual unification and dynamic languages, so the tradeoffs tend to favor simplicity and flexibility over performance.

Features

Syntax

In its simplest form, it is composed of a single identifier:

 doStuff

Assuming the above doStuff is a method, it is being called with zero arguments and as a result, explicit parentheses are not required.

If doStuff had arguments, it would look like this:

 doStuff(42)

Io is a message passing language, and since everything in Io is a message (excluding comments), each message is sent to a receiver. The above example demonstrates this well, but not fully. To describe this point better, let's look at the next example:

 System version

The above example demonstrates message passing in Io; the "version" message is sent to the "System" object.

Operators are a special case where the syntax is not as cut-and-dried as the above examples. The Io parser intercepts a set of operators defined by the interpreter, and translates them to method calls. For example, the following:

 1 + 5 * 8 + 1

translates to:

 1 + (5 *(8)) +(1)

As you can see, there is also a little bit of operator precedence happening here, and the precedence levels are the same as with the C precedence levels.

Operators were also turned into method calls. In fact, all operators in Io are methods; the fact that they do not require explicit parentheses is a convenience.

Methods and blocks

In Io there are two ways of creating anonymous functions: methods and blocks. Between them, they are almost identical except for scope. While blocks have lexical scope, methods have dynamic scope.

Both method and block are higher-order functions.

Examples

The ubiquitous Hello world program:

 "Hello, world!" println

New objects are created by cloning objects. In Io specifically, a new, empty object is created and only the differences between it and its parent are stored within the new object; this behavior is known as differential inheritance. An example of this behavior is shown:

 A := Object clone         // creates a new, empty object named "A"

A simple non-recursive factorial function, in Io:

factorial := method(n,
    if(n == 0, return 1)
    res := 1
    Range 1 to(n) foreach(i, res = res * i)
)

Because assignment of res * i to res is the last action taken, the function implicitly returns the result and so an explicit return expression is not needed. The above demonstrates the usage of ranges, and doesn't use a for() loop, which would be faster.

See also

Notes

  1. ^ Io Programming Guide

External links

  • Io home page
  • Io at Synrc Research Center
  • Io at DMOZ
  • Jasmine.Io BDD Testing Framework for Io
  • Seven Languages in Seven Weeks book which features Io
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 



Copyright © World Library Foundation. All rights reserved. eBooks from Hawaii eBook Library are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.