Io (programming Language)
   HOME

TheInfoList



OR:

Io is a pure
object-oriented programming Object-oriented programming (OOP) is a programming paradigm based on the concept of '' objects''. Objects can contain data (called fields, attributes or properties) and have actions they can perform (called procedures or methods and impl ...
language Language is a structured system of communication that consists of grammar and vocabulary. It is the primary means by which humans convey meaning, both in spoken and signed language, signed forms, and may also be conveyed through writing syste ...
inspired by
Smalltalk Smalltalk is a purely object oriented programming language (OOP) that was originally created in the 1970s for educational use, specifically for constructionist learning, but later found use in business. It was created at Xerox PARC by Learni ...
, Self, Lua,
Lisp Lisp (historically LISP, an abbreviation of "list processing") is a family of programming languages with a long history and a distinctive, fully parenthesized Polish notation#Explanation, prefix notation. Originally specified in the late 1950s, ...
, Act1, and NewtonScript. Io has a prototype-based object model similar to those in Self and NewtonScript, eliminating the distinction between instance and
class Class, Classes, or The Class may refer to: Common uses not otherwise categorized * Class (biology), a taxonomic rank * Class (knowledge representation), a collection of individuals or objects * Class (philosophy), an analytical concept used d ...
. Like Smalltalk, everything is an object and it uses dynamic typing. Like Lisp, programs are just data trees. Io uses
actor An actor (masculine/gender-neutral), or actress (feminine), is a person who portrays a character in a production. The actor performs "in the flesh" in the traditional medium of the theatre or in modern media such as film, radio, and television. ...
s 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 In computing, a virtual machine (VM) is the virtualization or emulator, emulation of a computer system. Virtual machines are based on computer architectures and provide the functionality of a physical computer. Their implementations may involve ...
.


History

The language was created by Steve Dekorte in 2002, after trying to help a friend, Dru Nelson, with his language, Cel. He learned 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

* Pure object-oriented based on prototypes * Code-as-data, homoiconic *
Lazy evaluation In programming language theory, lazy evaluation, or call-by-need, is an evaluation strategy which delays the evaluation of an Expression (computer science), expression until its value is needed (non-strict evaluation) and which avoids repeated eva ...
of function parameters *
Higher-order function In mathematics and computer science, a higher-order function (HOF) is a function that does at least one of the following: * takes one or more functions as arguments (i.e. a procedural parameter, which is a parameter of a procedure that is itself ...
s * Introspection, reflection and metaprogramming * Actor-based concurrency * Coroutines * Exception handling * Incremental garbage collecting supporting weak links * Highly portable * Shared
library A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
, dynamic-link library (DLL), dynamic loading on most platforms * Small
virtual machine In computing, a virtual machine (VM) is the virtualization or emulator, emulation of a computer system. Virtual machines are based on computer architectures and provide the functionality of a physical computer. Their implementations may involve ...


Syntax

In its simplest form, Io
syntax In linguistics, syntax ( ) is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure (constituenc ...
is composed of one 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 In computer science, message passing is a technique for invoking behavior (i.e., running a program) on a computer. The invoking program sends a message to a process (which may be an actor or object) and relies on that process and its supporting ...
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) All operators in Io are methods; the fact that they do not require explicit parentheses is a convenience. 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.


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 function In mathematics and computer science, a higher-order function (HOF) is a function that does at least one of the following: * takes one or more functions as arguments (i.e. a procedural parameter, which is a parameter of a procedure that is itself ...
s.


Examples

The ubiquitous Hello world program: "Hello, world!" println New objects are created by
cloning Cloning is the process of producing individual organisms with identical genomes, either by natural or artificial means. In nature, some organisms produce clones through asexual reproduction; this reproduction of an organism by itself without ...
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.


References


External links

* *
Io at Synrc Research Center
* , Behavior Driven Development (BDD) testing framework for Io {{DEFAULTSORT:Io (Programming Language) Programming languages Dynamic programming languages Dynamically typed programming languages Prototype-based programming languages Object-oriented programming languages Programming languages created in 2002 Scripting languages 2002 software Homoiconic programming languages