Svoboda | Graniru | BBC Russia | Golosameriki | Facebook

To install click the Add extension button. That's it.

The source code for the WIKI 2 extension is being checked by specialists of the Mozilla Foundation, Google, and Apple. You could also do it yourself at any point in time.

4,5
Kelly Slayton
Congratulations on this excellent venture… what a great idea!
Alexander Grigorievskiy
I use WIKI 2 every day and almost forgot how the original Wikipedia looks like.
Live Statistics
English Articles
Improved in 24 Hours
Added in 24 Hours
What we do. Every page goes through several hundred of perfecting techniques; in live mode. Quite the same Wikipedia. Just better.
.
Leo
Newton
Brights
Milds

Io (programming language)

From Wikipedia, the free encyclopedia

Io
Paradigmsobject-oriented prototype-based
Designed bySteve Dekorte
DevelopersSteve Dekorte, Jonathan Wright, Jeremy Tregunna
First appeared2002; 22 years ago (2002)
Stable release
20170906 / September 6, 2017; 6 years ago (2017-09-06)[1]
Preview release
2019.05.22-alpha / May 22, 2019; 5 years ago (2019-05-22)
Typing disciplinedynamic, strong
PlatformIA-32, x86-64; ARM, M1M4; .NET CLR
OSWindows, macOS
LicenseBSD 3-clause
Websiteiolanguage.org
Major implementations
Io Io.NET
Influenced by
Smalltalk, NewtonScript, Self, Lua, Lisp, Python, Act1
Influenced
Ioke, Potion

Io is a pure object-oriented programming language inspired by Smalltalk, Self, Lua, Lisp, Act1, and NewtonScript.[2] Io has a prototype-based object model similar to those in Self and NewtonScript, eliminating the distinction between instance and class. 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.[3] Io is executed by a small, portable virtual machine.

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.[4]

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, Io syntax is composed of one identifier:[5]

 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)

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 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.

References

  1. ^ "Io Releases". GitHub. Retrieved 2020-02-06.
  2. ^ Io Programming Guide
  3. ^ "Io Programming: Writing Addons". Wikibooks.org: open books for an open world. Retrieved 2023-06-22.
  4. ^ Tate, Bruce (2010). "Chapter 3: Io". Seven Languages in Seven Weeks: A Pragmatic Guide to Learning Programming Languages (1st ed.). Raleigh, North Carolina: Pragmatic Bookshelf. p. 60, 72. ISBN 978-1934356593.
  5. ^ "io guide". iolanguage.org. Retrieved 2023-06-22.

External links

This page was last edited on 23 June 2024, at 22:30
Basis of this page is in Wikipedia. Text is available under the CC BY-SA 3.0 Unported License. Non-text media are available under their specified licenses. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. WIKI 2 is an independent company and has no affiliation with Wikimedia Foundation.