Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Io (programming language)

From Wikipedia, the free encyclopedia
Prototype-based programming language
This article has multiple issues. Please helpimprove it or discuss these issues on thetalk page.(Learn how and when to remove these messages)
This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Io" programming language – news ·newspapers ·books ·scholar ·JSTOR
(August 2014) (Learn how and when to remove this message)
This articlerelies excessively onreferences toprimary sources. Please improve this article by addingsecondary or tertiary sources.
Find sources: "Io" programming language – news ·newspapers ·books ·scholar ·JSTOR
(August 2014) (Learn how and when to remove this message)
(Learn how and when to remove this message)
Io
Paradigmsobject-orientedprototype-based
Designed bySteve Dekorte
DevelopersSteve Dekorte, Jonathan Wright, Jeremy Tregunna
First appeared2002; 23 years ago (2002)
Stable release
20170906 / September 6, 2017; 8 years ago (2017-09-06)[1]
Preview release
2019.05.22-alpha / May 22, 2019; 6 years ago (2019-05-22)
Typing disciplinedynamic,strong
PlatformIA-32,x86-64;ARM;.NETCLR
OSWindows,macOS
LicenseBSD 3-clause
Websiteiolanguage.org
Majorimplementations
IoIo.NET
Influenced by
Smalltalk,NewtonScript,Self,Lua,Lisp,Python,Act1
Influenced
Ioke, Potion

Io is a pureobject-oriented programminglanguage inspired bySmalltalk,Self,Lua,Lisp,Act1, andNewtonScript.[2] Io has aprototype-based object model similar to those in Self and NewtonScript, eliminating the distinction betweeninstance andclass. Like Smalltalk, everything is an object and it usesdynamic typing. Like Lisp, programs are just data trees. Io usesactors for concurrency.

Remarkable features of Io are its minimal size and openness to using external code resources.[3] Io is executed by a small, portablevirtual machine.

History

[edit]

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

[edit]

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

Features

[edit]

Syntax

[edit]
This sectiondoes notcite anysources. Please helpimprove this section byadding citations to reliable sources. Unsourced material may be challenged andremoved.(June 2013) (Learn how and when to remove this message)

In its simplest form, Iosyntax is composed of one identifier:[5]

doStuff

Assuming the above doStuff is amethod, 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 amessage passing language, and since everything in Io is a message (excludingcomments), 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:

Systemversion

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 Ioparser 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 ofoperator precedence happening here, and the precedence levels are the same as with theC precedence levels.

Methods and blocks

[edit]

In Io there are two ways of creatinganonymous functions: methods and blocks. Between them, they are almost identical except forscope. While blocks havelexical scope, methods havedynamic scope.

Bothmethod andblock arehigher-order functions.

Examples

[edit]

The ubiquitousHello world program:

"Hello, world!"println

New objects are created bycloning 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 asdifferential inheritance. An example of this behavior is shown:

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

A simple non-recursive factorial function, in Io:

factorial:=method(n,if(n==0,return1)res:=1Range1to(n)foreach(i,res=res*i))

Because assignment ofres * i tores 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 ofranges, and doesn't use afor() loop, which would be faster.

References

[edit]
  1. ^"Io Releases".GitHub. Retrieved2020-02-06.
  2. ^Io Programming Guide
  3. ^"Io Programming: Writing Addons".Wikibooks.org: open books for an open world. Retrieved2023-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. Retrieved2023-06-22.

External links

[edit]
Retrieved from "https://en.wikipedia.org/w/index.php?title=Io_(programming_language)&oldid=1317279224"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp