Io.IoLanguage History
Hide minor edits - Show changes to markup
Most programming languages allow to define new types ; in object-oriented programming, new types are defined with classes. Classes can be considered as a model that will be reproduced by the instances, the reproduction of the model is done by the class constructor operations. The main problem with classes is that they may not be referencable or accessible (if the language is not reflexive like C++, unlike Java), and that it is definitely not possible to modify them at runtime.
Prototypes allow to do the same as defining new types through classes: instead of describing a class, we construct an object that will serve as the actual model for future "instances". The equivalent operation to creating an instance is simply to "clone" the prototype. This language trait allow to freely manipulate prototype, which is not always possible with classes (though a fully reflexive non-prototype language would certainly exhibit the same features).
The idea behind prototypes (which could also be called "stereotype") is that you build a collection of predefined objects that will serve as a basis for all object that will be based on them. Prototype is a very interesting way to weave objets together.
Most programming languages allow to define new types ; in class-based languages, new types are defined with classes. Classes can be considered as a model that will be reproduced by the instances, the reproduction of the model is done by the class constructor operations. The main problem with classes is that they may not be referencable or accessible (if the language is not reflexive like C++, unlike Java), and that it is definitely not possible to modify them at runtime.
Prototypes allow to do the same as defining new types through classes: instead of describing a class, we construct an object that will serve as the actual model for future "instances". The equivalent operation to creating an instance is simply to "clone" the prototype. This language trait allows to freely manipulate prototypes, which is not always possible with classes (though a fully reflexive non-prototype language would certainly exhibit the same features).
The idea behind prototypes (which could also be called "stereotypes") is that you build a collection of predefined objects that will serve as bases for all objects that will be based on them. Prototype is a very interesting way to weave objects together.
-- BayleShanks?
-- BayleShanks?
Feel free to add comments on this document.
Feel free to add comments on this document.
In this line of code there's two closing parens but only one opening; is that right?:
IoTag? *tag = IoState?_tagWithInitFunction_(ioState, StateTagInit?*)IoBlock?_initTagWithId_);
-- BayleShanks?
Io language main site is available at http://www.iolanguage.com, Steve's page is available at http://www.dekorte.com. There is also the main Io wiki available at http://io.kicks-ass.net/FrontPage.
Io language main site is available at http://www.iolanguage.com, Steve's page is available at http://www.dekorte.com. There is also the main Io wiki available at http://io.kicks-ass.net/FrontPage. !! Server not responding? !!
You can check out some more Io examples here [1] !! This link seems to be broken!!.
You can check out some more Io examples here [1]
- Reactive objects by Joan Nordlander
- Lambda the Ultimate
- Reactive Objects by Johan Nordlander
- Lambda the Ultimate
You can check out some more Io examples here http://www.iolanguage.com/SampleCode.html.
You can check out some more Io examples here http://www.iolanguage.com/SampleCode.html !! This link seems to be broken!!.
[ http://texas-holdem.freeservers.com texas holdem] [ http://play-online-casino.freeservers.com play online casino] [ http://play-online-casino.freeservers.com/online-poker.html online poker] [ http://play-online-casino.freeservers.com/blackjack.html blackjack] [ http://play-online-casino.freeservers.com/roulette.html roulette] [ http://play-online-casino.freeservers.com/online-slots.html online slots] [ http://play-online-casino.freeservers.com/video-poker.html video poker] [ http://play-online-casino.freeservers.com/keno.html keno] [ http://play-online-casino.freeservers.com/craps.html craps] [ http://play-online-casino.freeservers.com/caribbean-poker.html caribbean poker] [ http://play-online-casino.freeservers.com/baccarat.html baccarat] [ http://levitra-i.freeservers.com levitra] [ http://buy-levitra-i.freeservers.com buy levitra] [ http://online-levitra.freeservers.com online levitra] [ http://cheap-levitra.freeservers.com cheap levitra] [ http://online-cialis.freeservers.com online cialis] [ http://cialis-i.freeservers.com cialis] [ http://buy-cialis.freeservers.com buy cialis] [ http://cheap-cialis.freeservers.com cheap cialis] [ http://buy-soma.freeservers.com buy soma] [ http://soma-i.freeservers.com soma] [ http://cheap-soma.freeservers.com cheap soma] [ http://online-soma.freeservers.com online soma] [ http://buy-tramadol.freeservers.com buy tramadol] [ http://tramadol-i.freeservers.com tramadol] [ http://online-tramadol.freeservers.com online tramadol] [ http://cheap-tramadol.freeservers.com cheap tramadol] [ http://fioricet.freeservers.com fioricet] [ http://buy-fioricet-i.freeservers.com buy fioricet] [ http://online-fioricet.freeservers.com online fioricet] [ http://ambien-i.freeservers.com ambien] [ http://buy-ambien-i.freeservers.com buy ambien] [ http://cheap-ambien.freeservers.com cheap ambien] [ http://online-ambien.freeservers.com online ambien] [ http://ultram.freeservers.com ultram] [ http://buy-ultram.freeservers.com buy ultram] [ http://cheap-ultram.freeservers.com cheap ultram] [ http://www.texas----holdem.com texas holdem] [ http://www.texas--hold-em.com texas hold em] [ http://www.texas---holdem.us texas holdem] [ http://www.online---poker.us online poker] [ http://www.top-poker-tables.com poker tables] [ http://www.online-poker--sites.com online poker] [ http://www.empire-poker-site.com empire poker] [ http://www.poker--table.com poker table] [ http://www.poker--rooms.us poker room] [ http://www.internet-poker-site.us internet poker] [ http://www.empire--poker.com empire poker] [ http://www.online-poker--game.com online poker game] [ http://www.online-poker-online.us online poker] [ http://www.wirenorth.com ] [ http://www.themailingconsultant.com ] [ http://www.thecraftersgallery.com ] [ http://www.mnfastpitch.com ] [ http://www.madhousebar.com ] [ http://www.johnhowesatty.com ] [ http://www.hchcinc.com ] [ http://www.carmenfan.com ] [ http://www.play-poker-for-free.us play poker free] [ http://www.online-poker-free.com online poker free] [ http://www.free-poker-rooms.us free poker rooms] [ http://www.free--online-poker.us free online poker] [ http://www.free--online-poker.com free online poker] [ http://www.poker-texas-hold-em.biz poker texas hold em] [ http://www.i-texas-hold-em.biz texas hold em] [ http://www.i-texas-holdem.biz texas holdem] [ http://www.i-texas-hold-em.us texas hold em] [ http://www.i-texas-holdem.us texas holdem] [ http://www.poker-texas-holdem.us poker texas holdem] [ http://www.poker-texas-hold-em.us poker texas hold em] [ http://www.poker-texas-hold-em.info poker texas hold em] [ http://www.i-texas-holdem.info texas holdem] [ http://www.i-texas-hold-em.info texas hold em] [ http://www.i-play-poker-online.com play poker online] [ http://www.play-7-card-stud-poker.com play 7 card stud poker] [ http://www.seven-card-stud.biz seven card stud] [ http://www.i-play-poker-online.biz play poker online] [ http://www.free-texas-hold-em.biz free texas hold em] [ http://www.free-texas-holdem-poker.us free texas holdem poker] [ http://www.play-7-card-stud-poker.us play 7 card stud poker] [ http://www.texasholdem-online.us texas holdem online] [ http://www.online-texasholdem.us online texas holdem] [ http://www.play-texas-holdem.us play texas holdem] [ http://www.i-play-poker-online.com play poker online] [ http://www.seven-card-stud.us seven card stud] [ http://www.i-play-poker-online.us play poker online] [ http://www.free-texasholdem.us free texas holdem] [ http://www.free-texashold-em.us free texas hold em] [ http://www.play-texas-hold-em.us play texas hold em] [ http://www.online-texas-hold-em.us online texas hold em] [ http://www.texasholdem-poker.us texas holdem poker] [ http://www.i-texas-holdem.com texas holdem] [ http://www.i-texas-hold-em.com texas holdem] [ http://www.online-texas-hold-em.net online texas hold em]
Io language notes
Io is a small, well-designed and efficient scripting language created in 2002 by Steve Dekorte. Io is particularily pleasant because it has a rather clean, regular syntax that frees us from the ugly C-style braces and trailing semicolons, pretty much like an hybrid of Python and Lisp. Io also offers very high level language traits that condense much of the advances made in scripting years since the 90s.
Io notably introduces some interesting perspectives and features such as prototype-based inhertiance, asynchronous execution operator, or full reflectivity.
Io language main site is available at http://www.iolanguage.com, Steve's page is available at http://www.dekorte.com. There is also the main Io wiki available at http://io.kicks-ass.net/FrontPage.
Related pages:
- QuestionsAndAnswers, questions and answers that came on the Io mailing list
- {{Gotchas}}, a page that tries to collect common gotchas for Io newbies
- PrototypesVsClasses, compares the prototype-based inheritance to the class-based inheritance
- ObjcBridge, introduces the bridge that allows cross-integration of Io and Objective-C.
- ModuleSystem, a draft for a module/package system for Io
- DocumentationSystem, a draft for a documentation system for Io
- IoUnit, a simple automated testing framework for Io
1. A quick glance at Io
Here is an Object-oriented "Hello World" written in Io:
HelloObject = Object clone
HelloObject sayHello = method(
"Hello World!" print
)
HelloObject sayHello()
You can check out some more Io examples here http://www.iolanguage.com/SampleCode.html.
2. Io language traits
Now that the impatient was fed with some source code, I will introduce Io from a more theorical point of view and expose the traits (a.k.a. the language features) that make it such a pleasant beast:
- Prototype-based inheritance: Inheritance in IO is realised by cloning objects and maintaining a dynamic relation between the clone and the original.
- Purely Object-Oriented: all entities that are manipulated in Io derive from the same Object prototype.
- Garbage-collected: objects are automatically allocated and deallocated.
- Dynamically typed: although Io has a notion of type, variables are untyped and operations prototypes do not carry type information. Some type checks can be made using generally available methods.
- Strongly typed: all interactions are through messages to object. Memory is never accessed directly.
- Interpreted: Io source code is not compiled to bytecode but rather read and converted to an in-memory representation.
- Code as data: blocks of code are reified into objects, which can be modified and dynamically created.
- Reflective: as a consequence of the "code as data", it is possible to investigate the properties of any Io object at runtime, including its source code.
- Dynamic: because code is data (and vice-versa), it is possible to change a program logic during its execution. It is of course also possible to dynamically modify an object attributes and operations at runtime. Combined with the prototype-based inheritance, this allows to dynamically "change an object class".
Although Io shares some traits with functional languages, Io could be considered as a member of the imperative family of languages. However, Io dynamicity and deep reflectivity enables programming styles that are not usually possible with other languages from the imperative family.
I consider Io as a very interesting language for scripting existing applications, while I would rather advice the use of a statically, strongly typed language for the application core. Io has a simple syntax, is very flexible and powerful, but lacks some features of more mature languages, such as Python:
- Io does not offer a module/package system
- There is no code documentation tool (e.g. JavaDoc?, POD, PyDoc?, etc)
- There are no type-checking/object utilities (interfaces)
Io is constently evoloving, and Steve is rather open to comments, as proved the improvement of the VM toward a single-rooted object hierarchy (primitives used to inherit from IoValue?, and Object was a primitive) undergone in June 2003. In this respect, this small disadvantages will be surely be resolved in the future. In the meantime, Io is really fun to play with, and is a perfect language to be embedded in an application (especially Objective-C apps ;).
3. Io terminology
To have a better understanding of the different terms encountered in Io documentation and in the Io mailing list, here is a short list of terms with their accompanying definition:
- Prototype: a prototype is an object that can be cloned. The link between a clone and its prototype is very close to the link between a class and an instance. Clones will resolve attributes and operations that are not locally defined in their prototype. If this sounds abstract, you can think of prototypes as classes that you could create and manipulate just as other objects.
- Slot: a slot is an object part that allows to bind values to names. Slots can be considered as a name --> value mapping belonging to a particular object. Attributes and operations are first resolved in an object slot.
- Actor: First introduced by Carl Hewitt in his PLANNER paper of 1969, the concept of an actor is equivalent to an active object (thread) that would asynchronously process received messages (like operations). In Gul Agha actor model, messages are first queued in a FIFO attached to the object, and sequentially processed.
- Asynchronous message: when an object (sender) sends a message to another object (receiver), the sender usually waits for the sender to receive the message, process it and send a response (indicating the message was processed, optionally with a return value). This is called synchronous communication, when sending is a blocking act for the sender. With asynchronous messages, the sender simply sends the message, but do not wait for the response, enable it to continue to act while the message is processed by the receiver.
- Future: also know as "promise" a Future is an encapsulation of the future response message (actually response value) to an asynchronous message. A future enables objects to reference a value that is not yet computed.
Note: Maybe also exlain continuation, scope, resolution, tag, typed and untyped, reflectivity, etc.
Recommendend readings:
- Reactive objects by Joan Nordlander
- Lambda the Ultimate
4. Io object model
Io is a purely object-oriented language, which means that everything is an object. Many object languages that derive from the C family are not able to manipulate primitive types (integers, floats, etc) consistently with object. Io has a single primitive: the Object. In this respect, the dynamic properties of objects are available for all entities in Io.
Definition of a message Prototype based Values, Primitives and Objects Mechanisms involved in responsing to a message Messaging model
Io has the very appreciable feature of accessing the object that sent a message to the receiving object. This allows to modify the behaviour of the receiving object according to the type of the invoking object. The sender object is accessible using the "sender" slot of the receiving object.
5. Understanding Io concepts
Io is based on some concepts that may not be familiar to people used to common programming languages such as C, C++ or Java. At first, Io is inspired by the following kinds of languages:
- Prototype-based language: languages that realise inheritance by cloning object rather than instanciating them from a class.
- Actor language: languages that consider objects to be dynamic and to communicate with messages
- Functional languages: languages that provide a lambda-like operator, either closure or blocks.
Don't be afraid if you don't know the languages or understand my short presentation, this will be explained here.
A. Types and Protoypes
Even if types and prototypes share the same "types" suffix, they both represent different things. A type qualifies and categories a given value, while a prototype is already a value.
Most programming languages allow to define new types ; in object-oriented programming, new types are defined with classes. Classes can be considered as a model that will be reproduced by the instances, the reproduction of the model is done by the class constructor operations. The main problem with classes is that they may not be referencable or accessible (if the language is not reflexive like C++, unlike Java), and that it is definitely not possible to modify them at runtime.
Prototypes allow to do the same as defining new types through classes: instead of describing a class, we construct an object that will serve as the actual model for future "instances". The equivalent operation to creating an instance is simply to "clone" the prototype. This language trait allow to freely manipulate prototype, which is not always possible with classes (though a fully reflexive non-prototype language would certainly exhibit the same features).
The idea behind prototypes (which could also be called "stereotype") is that you build a collection of predefined objects that will serve as a basis for all object that will be based on them. Prototype is a very interesting way to weave objets together.
A good thing would also be to have a look at this page http://www.wikipedia.org/wiki/Prototype_based.
B. Types and Tags
Tag in Io are inspired from Lua typing system [2], a tag specifies a given type. For instance, a Lua function could be either implemented in Lua or in C. To make the difference between both functions (which are considered as first-class language citizens, ie. values) the tag is used to indicate wether the function is in C or in Lua. Tags can then be considered as a sub-type.
Tags are useful for customising Io because they allow to extend or redefine the behaviour of a specific type, like for instance redefine how a list would react the add or remove messages.
Steve gives the following explaination on tags :
Every value is a primitive of some sort - a String, List, Objects, etc. And the data structure for each primitive begins with "mark" and "tag" members.
Example:
typedef struct { IoMark? mark; Tag *tag; ByteArray? *byteArray; } IoString?;
The mark is for garbage collection purposes and the tag is a reference the primitive's tag datastructure. The tag is used to figure out which C function to call for a given operation on a value. For example, when the garbage collector decides to free the IoString??, it ends up looking in the IoString??'s tag and finds the freeFunc function pointer and calls it. This function pointer is set to IoString?_free. The freeFunc function pointer in a tag for a different primitive would would be set to a different C function. This makes it easier for people to externally add new primitves.
Links:
- [2] See Lua 4.http://www.lua.org/manual/4.0/manual.html manual in sections 3 and 4, at http://www.lua.org/manual/4.0/manual.html. They provide a great
explaination on how tags can be used.
C. Reflectivity
Io is an intrinsically open language, as it offers very powerful reflexive features. One of the interesting features is that Io stores the whole program as a tree that mirrors the source code. This tree is not compiled to bytecode, but is rather directly executed.
One of the side effects of this choice is that you can get the source code at anytime. For instance, any Io object can output its source code. This is a truely interesting feature from an open-source development perspective, which recalls me the power of categories in Objective-C.
D. Language constructs reification
The combination of tags and reflexivity grants Io with very powerful self-modifications features, such as redefining the behaviour of executing a block value. Here is a Io code snippet that substitutes the default block activation function with a new one:
IoTag? *tag = IoState?_tagWithInitFunction_(ioState, StateTagInit?*)IoBlock?_initTagWithId_); tag->activationFunc = MyBlockActivationFunc?;
then in the activation function, you can do what you want:
IoValue? * MyBlockActivationFunc?(IoBlock? *self, IoObject? *target, IoObject? *locals, IoMessage? *m) { /* Do what I want */ /* And call the normal IoBlock? activation function */ IoBlock?_target_locals_call_(self, target, locals, m); }
[ Note that this example was given by Steve on the Io mailing-list]
I'm not sure if this is the right term for qualifying this, but to me, language reification means that the language internal mechanism is reified so as to be able to reprogram the language with the language itself (or through the use of simple extensions in C).
See http://www.wikipedia.org/wiki/Dynamic_typing
Comments
Feel free to add comments on this document.
Please stop advertising spam on this page.
[ http://texas-holdem.freeservers.com texas holdem] [ http://play-online-casino.freeservers.com play online casino] [ http://play-online-casino.freeservers.com/online-poker.html online poker] [ http://play-online-casino.freeservers.com/blackjack.html blackjack] [ http://play-online-casino.freeservers.com/roulette.html roulette] [ http://play-online-casino.freeservers.com/online-slots.html online slots] [ http://play-online-casino.freeservers.com/video-poker.html video poker] [ http://play-online-casino.freeservers.com/keno.html keno] [ http://play-online-casino.freeservers.com/craps.html craps] [ http://play-online-casino.freeservers.com/caribbean-poker.html caribbean poker] [ http://play-online-casino.freeservers.com/baccarat.html baccarat] [ http://levitra-i.freeservers.com levitra] [ http://buy-levitra-i.freeservers.com buy levitra] [ http://online-levitra.freeservers.com online levitra] [ http://cheap-levitra.freeservers.com cheap levitra] [ http://online-cialis.freeservers.com online cialis] [ http://cialis-i.freeservers.com cialis] [ http://buy-cialis.freeservers.com buy cialis] [ http://cheap-cialis.freeservers.com cheap cialis] [ http://buy-soma.freeservers.com buy soma] [ http://soma-i.freeservers.com soma] [ http://cheap-soma.freeservers.com cheap soma] [ http://online-soma.freeservers.com online soma] [ http://buy-tramadol.freeservers.com buy tramadol] [ http://tramadol-i.freeservers.com tramadol] [ http://online-tramadol.freeservers.com online tramadol] [ http://cheap-tramadol.freeservers.com cheap tramadol] [ http://fioricet.freeservers.com fioricet] [ http://buy-fioricet-i.freeservers.com buy fioricet] [ http://online-fioricet.freeservers.com online fioricet] [ http://ambien-i.freeservers.com ambien] [ http://buy-ambien-i.freeservers.com buy ambien] [ http://cheap-ambien.freeservers.com cheap ambien] [ http://online-ambien.freeservers.com online ambien] [ http://ultram.freeservers.com ultram] [ http://buy-ultram.freeservers.com buy ultram] [ http://cheap-ultram.freeservers.com cheap ultram] [ http://www.texas----holdem.com texas holdem] [ http://www.texas--hold-em.com texas hold em] [ http://www.texas---holdem.us texas holdem] [ http://www.online---poker.us online poker] [ http://www.top-poker-tables.com poker tables] [ http://www.online-poker--sites.com online poker] [ http://www.empire-poker-site.com empire poker] [ http://www.poker--table.com poker table] [ http://www.poker--rooms.us poker room] [ http://www.internet-poker-site.us internet poker] [ http://www.empire--poker.com empire poker] [ http://www.online-poker--game.com online poker game] [ http://www.online-poker-online.us online poker] [ http://www.wirenorth.com ] [ http://www.themailingconsultant.com ] [ http://www.thecraftersgallery.com ] [ http://www.mnfastpitch.com ] [ http://www.madhousebar.com ] [ http://www.johnhowesatty.com ] [ http://www.hchcinc.com ] [ http://www.carmenfan.com ] [ http://www.play-poker-for-free.us play poker free] [ http://www.online-poker-free.com online poker free] [ http://www.free-poker-rooms.us free poker rooms] [ http://www.free--online-poker.us free online poker] [ http://www.free--online-poker.com free online poker] [ http://www.poker-texas-hold-em.biz poker texas hold em] [ http://www.i-texas-hold-em.biz texas hold em] [ http://www.i-texas-holdem.biz texas holdem] [ http://www.i-texas-hold-em.us texas hold em] [ http://www.i-texas-holdem.us texas holdem] [ http://www.poker-texas-holdem.us poker texas holdem] [ http://www.poker-texas-hold-em.us poker texas hold em] [ http://www.poker-texas-hold-em.info poker texas hold em] [ http://www.i-texas-holdem.info texas holdem] [ http://www.i-texas-hold-em.info texas hold em] [ http://www.i-play-poker-online.com play poker online] [ http://www.play-7-card-stud-poker.com play 7 card stud poker] [ http://www.seven-card-stud.biz seven card stud] [ http://www.i-play-poker-online.biz play poker online] [ http://www.free-texas-hold-em.biz free texas hold em] [ http://www.free-texas-holdem-poker.us free texas holdem poker] [ http://www.play-7-card-stud-poker.us play 7 card stud poker] [ http://www.texasholdem-online.us texas holdem online] [ http://www.online-texasholdem.us online texas holdem] [ http://www.play-texas-holdem.us play texas holdem] [ http://www.i-play-poker-online.com play poker online] [ http://www.seven-card-stud.us seven card stud] [ http://www.i-play-poker-online.us play poker online] [ http://www.free-texasholdem.us free texas holdem] [ http://www.free-texashold-em.us free texas hold em] [ http://www.play-texas-hold-em.us play texas hold em] [ http://www.online-texas-hold-em.us online texas hold em] [ http://www.texasholdem-poker.us texas holdem poker] [ http://www.i-texas-holdem.com texas holdem] [ http://www.i-texas-hold-em.com texas holdem] [ http://www.online-texas-hold-em.net online texas hold em]
Io is one of the coolest programming languages there is. Please see http://www.iolanguage.com for more details.
Also check out the RecentChanges on this Wiki too.
online casinohttp://luukurkkuun.com/gay-gang-bang-college-gang.html .http://orgy-sex.selectedsex.com/anal-gang-bang-crew-gang.html .http://gang-bang.sex4dollar.com/wife-gang-bang-gang-milf.html .http://house9999.com/orgy-sex.html .http://beitshalomadelaide.com/wife-gang-bang-gang-milf.html .
Please stop advertising spam on this page.
Io is one of the coolest programming languages there is. Please see http://www.iolanguage.com for more details.
Also check out the RecentChanges on this Wiki too.
[http://www.casino-online-on-line.com] * [Online Casino | http://www.casino-online-on-line.com] * [Casino Online | http://www.casino-online-on-line.com] * [http://www.casino-online-on-line.com online casino] - games, internet casino, casino online casino, poker * [http://www.casino-online-on-line.com casino online] - games, internet casino, casino online casino, poker i want to play with sandbox... <a href="http://www.casino-online-on-line.com">online casino</a> it"s a very nice keyboard <a href="http://www.casino-online-on-line.com">casino online</a> the casino roulette as well <a href="http://www.casino-online-on-line.com">Internet Casino</a> sopranos is pretty exciting <a href="http://www.casino-online-on-line.com">Casino</a> money <a href="http://www.casino-online-on-line.com">online Poker</a> jesus christ <a href="http://www.casino-online-on-line.com">casino-online</a> with gir <a href="http://www.casino-online-on-line.com">online-casino</a> i would google family <a href="http://www.google.com">Google</a> about my alone gamblinghttp://luukurkkuun.com/gay-gang-bang-college-gang.html .http://orgy-sex.selectedsex.com/anal-gang-bang-crew-gang.html .http://gang-bang.sex4dollar.com/wife-gang-bang-gang-milf.html .http://house9999.com/orgy-sex.html .http://beitshalomadelaide.com/wife-gang-bang-gang-milf.html .
online casinohttp://luukurkkuun.com/gay-gang-bang-college-gang.html .http://orgy-sex.selectedsex.com/anal-gang-bang-crew-gang.html .http://gang-bang.sex4dollar.com/wife-gang-bang-gang-milf.html .http://house9999.com/orgy-sex.html .http://beitshalomadelaide.com/wife-gang-bang-gang-milf.html .
Io language notes
Io is a small, well-designed and efficient scripting language created in 2002 by Steve Dekorte. Io is particularily pleasant because it has a rather clean, regular syntax that frees us from the ugly C-style braces and trailing semicolons, pretty much like an hybrid of Python and Lisp. Io also offers very high level language traits that condense much of the advances made in scripting years since the 90s.
Io notably introduces some interesting perspectives and features such as prototype-based inhertiance, asynchronous execution operator, or full reflectivity.
Io language main site is available at http://www.iolanguage.com, Steve's page is available at http://www.dekorte.com. There is also the main Io wiki available at http://io.kicks-ass.net/FrontPage.
Related pages:
- QuestionsAndAnswers, questions and answers that came on the Io mailing list
- {{Gotchas}}, a page that tries to collect common gotchas for Io newbies
- PrototypesVsClasses, compares the prototype-based inheritance to the class-based inheritance
- ObjcBridge, introduces the bridge that allows cross-integration of Io and Objective-C.
- ModuleSystem, a draft for a module/package system for Io
- DocumentationSystem, a draft for a documentation system for Io
- IoUnit, a simple automated testing framework for Io
1. A quick glance at Io
Here is an Object-oriented "Hello World" written in Io:
HelloObject = Object clone
HelloObject sayHello = method(
"Hello World!" print
)
HelloObject sayHello()
You can check out some more Io examples here http://www.iolanguage.com/SampleCode.html.
2. Io language traits
Now that the impatient was fed with some source code, I will introduce Io from a more theorical point of view and expose the traits (a.k.a. the language features) that make it such a pleasant beast:
- Prototype-based inheritance: Inheritance in IO is realised by cloning objects and maintaining a dynamic relation between the clone and the original.
- Purely Object-Oriented: all entities that are manipulated in Io derive from the same Object prototype.
- Garbage-collected: objects are automatically allocated and deallocated.
- Dynamically typed: although Io has a notion of type, variables are untyped and operations prototypes do not carry type information. Some type checks can be made using generally available methods.
- Strongly typed: all interactions are through messages to object. Memory is never accessed directly.
- Interpreted: Io source code is not compiled to bytecode but rather read and converted to an in-memory representation.
- Code as data: blocks of code are reified into objects, which can be modified and dynamically created.
- Reflective: as a consequence of the "code as data", it is possible to investigate the properties of any Io object at runtime, including its source code.
- Dynamic: because code is data (and vice-versa), it is possible to change a program logic during its execution. It is of course also possible to dynamically modify an object attributes and operations at runtime. Combined with the prototype-based inheritance, this allows to dynamically "change an object class".
Although Io shares some traits with functional languages, Io could be considered as a member of the imperative family of languages. However, Io dynamicity and deep reflectivity enables programming styles that are not usually possible with other languages from the imperative family.
I consider Io as a very interesting language for scripting existing applications, while I would rather advice the use of a statically, strongly typed language for the application core. Io has a simple syntax, is very flexible and powerful, but lacks some features of more mature languages, such as Python:
- Io does not offer a module/package system
- There is no code documentation tool (e.g. JavaDoc?, POD, PyDoc?, etc)
- There are no type-checking/object utilities (interfaces)
Io is constently evoloving, and Steve is rather open to comments, as proved the improvement of the VM toward a single-rooted object hierarchy (primitives used to inherit from IoValue?, and Object was a primitive) undergone in June 2003. In this respect, this small disadvantages will be surely be resolved in the future. In the meantime, Io is really fun to play with, and is a perfect language to be embedded in an application (especially Objective-C apps ;).
3. Io terminology
To have a better understanding of the different terms encountered in Io documentation and in the Io mailing list, here is a short list of terms with their accompanying definition:
- Prototype: a prototype is an object that can be cloned. The link between a clone and its prototype is very close to the link between a class and an instance. Clones will resolve attributes and operations that are not locally defined in their prototype. If this sounds abstract, you can think of prototypes as classes that you could create and manipulate just as other objects.
- Slot: a slot is an object part that allows to bind values to names. Slots can be considered as a name --> value mapping belonging to a particular object. Attributes and operations are first resolved in an object slot.
- Actor: First introduced by Carl Hewitt in his PLANNER paper of 1969, the concept of an actor is equivalent to an active object (thread) that would asynchronously process received messages (like operations). In Gul Agha actor model, messages are first queued in a FIFO attached to the object, and sequentially processed.
- Asynchronous message: when an object (sender) sends a message to another object (receiver), the sender usually waits for the sender to receive the message, process it and send a response (indicating the message was processed, optionally with a return value). This is called synchronous communication, when sending is a blocking act for the sender. With asynchronous messages, the sender simply sends the message, but do not wait for the response, enable it to continue to act while the message is processed by the receiver.
- Future: also know as "promise" a Future is an encapsulation of the future response message (actually response value) to an asynchronous message. A future enables objects to reference a value that is not yet computed.
Note: Maybe also exlain continuation, scope, resolution, tag, typed and untyped, reflectivity, etc.
Recommendend readings:
- Reactive objects by Joan Nordlander
- Lambda the Ultimate
4. Io object model
Io is a purely object-oriented language, which means that everything is an object. Many object languages that derive from the C family are not able to manipulate primitive types (integers, floats, etc) consistently with object. Io has a single primitive: the Object. In this respect, the dynamic properties of objects are available for all entities in Io.
Definition of a message Prototype based Values, Primitives and Objects Mechanisms involved in responsing to a message Messaging model
Io has the very appreciable feature of accessing the object that sent a message to the receiving object. This allows to modify the behaviour of the receiving object according to the type of the invoking object. The sender object is accessible using the "sender" slot of the receiving object.
5. Understanding Io concepts
Io is based on some concepts that may not be familiar to people used to common programming languages such as C, C++ or Java. At first, Io is inspired by the following kinds of languages:
- Prototype-based language: languages that realise inheritance by cloning object rather than instanciating them from a class.
- Actor language: languages that consider objects to be dynamic and to communicate with messages
- Functional languages: languages that provide a lambda-like operator, either closure or blocks.
Don't be afraid if you don't know the languages or understand my short presentation, this will be explained here.
A. Types and Protoypes
Even if types and prototypes share the same "types" suffix, they both represent different things. A type qualifies and categories a given value, while a prototype is already a value.
Most programming languages allow to define new types ; in object-oriented programming, new types are defined with classes. Classes can be considered as a model that will be reproduced by the instances, the reproduction of the model is done by the class constructor operations. The main problem with classes is that they may not be referencable or accessible (if the language is not reflexive like C++, unlike Java), and that it is definitely not possible to modify them at runtime.
Prototypes allow to do the same as defining new types through classes: instead of describing a class, we construct an object that will serve as the actual model for future "instances". The equivalent operation to creating an instance is simply to "clone" the prototype. This language trait allow to freely manipulate prototype, which is not always possible with classes (though a fully reflexive non-prototype language would certainly exhibit the same features).
The idea behind prototypes (which could also be called "stereotype") is that you build a collection of predefined objects that will serve as a basis for all object that will be based on them. Prototype is a very interesting way to weave objets together.
A good thing would also be to have a look at this page http://www.wikipedia.org/wiki/Prototype_based.
B. Types and Tags
Tag in Io are inspired from Lua typing system [2], a tag specifies a given type. For instance, a Lua function could be either implemented in Lua or in C. To make the difference between both functions (which are considered as first-class language citizens, ie. values) the tag is used to indicate wether the function is in C or in Lua. Tags can then be considered as a sub-type.
Tags are useful for customising Io because they allow to extend or redefine the behaviour of a specific type, like for instance redefine how a list would react the add or remove messages.
Steve gives the following explaination on tags :
Every value is a primitive of some sort - a String, List, Objects, etc. And the data structure for each primitive begins with "mark" and "tag" members.
Example:
typedef struct { IoMark? mark; Tag *tag; ByteArray? *byteArray; } IoString?;
The mark is for garbage collection purposes and the tag is a reference the primitive's tag datastructure. The tag is used to figure out which C function to call for a given operation on a value. For example, when the garbage collector decides to free the IoString??, it ends up looking in the IoString??'s tag and finds the freeFunc function pointer and calls it. This function pointer is set to IoString?_free. The freeFunc function pointer in a tag for a different primitive would would be set to a different C function. This makes it easier for people to externally add new primitves.
Links:
- [2] See Lua 4.http://www.lua.org/manual/4.0/manual.html manual in sections 3 and 4, at http://www.lua.org/manual/4.0/manual.html. They provide a great
explaination on how tags can be used.
C. Reflectivity
Io is an intrinsically open language, as it offers very powerful reflexive features. One of the interesting features is that Io stores the whole program as a tree that mirrors the source code. This tree is not compiled to bytecode, but is rather directly executed.
One of the side effects of this choice is that you can get the source code at anytime. For instance, any Io object can output its source code. This is a truely interesting feature from an open-source development perspective, which recalls me the power of categories in Objective-C.
D. Language constructs reification
The combination of tags and reflexivity grants Io with very powerful self-modifications features, such as redefining the behaviour of executing a block value. Here is a Io code snippet that substitutes the default block activation function with a new one:
IoTag? *tag = IoState?_tagWithInitFunction_(ioState, StateTagInit?*)IoBlock?_initTagWithId_); tag->activationFunc = MyBlockActivationFunc?;
then in the activation function, you can do what you want:
IoValue? * MyBlockActivationFunc?(IoBlock? *self, IoObject? *target, IoObject? *locals, IoMessage? *m) { /* Do what I want */ /* And call the normal IoBlock? activation function */ IoBlock?_target_locals_call_(self, target, locals, m); }
[ Note that this example was given by Steve on the Io mailing-list]
I'm not sure if this is the right term for qualifying this, but to me, language reification means that the language internal mechanism is reified so as to be able to reprogram the language with the language itself (or through the use of simple extensions in C).
See http://www.wikipedia.org/wiki/Dynamic_typing
Comments
Feel free to add comments on this document.
[http://www.casino-online-on-line.com] * [Online Casino | http://www.casino-online-on-line.com] * [Casino Online | http://www.casino-online-on-line.com] * [http://www.casino-online-on-line.com online casino] - games, internet casino, casino online casino, poker * [http://www.casino-online-on-line.com casino online] - games, internet casino, casino online casino, poker i want to play with sandbox... <a href="http://www.casino-online-on-line.com">online casino</a> it"s a very nice keyboard <a href="http://www.casino-online-on-line.com">casino online</a> the casino roulette as well <a href="http://www.casino-online-on-line.com">Internet Casino</a> sopranos is pretty exciting <a href="http://www.casino-online-on-line.com">Casino</a> money <a href="http://www.casino-online-on-line.com">online Poker</a> jesus christ <a href="http://www.casino-online-on-line.com">casino-online</a> with gir <a href="http://www.casino-online-on-line.com">online-casino</a> i would google family <a href="http://www.google.com">Google</a> about my alone gamblinghttp://luukurkkuun.com/gay-gang-bang-college-gang.html .http://orgy-sex.selectedsex.com/anal-gang-bang-crew-gang.html .http://gang-bang.sex4dollar.com/wife-gang-bang-gang-milf.html .http://house9999.com/orgy-sex.html .http://beitshalomadelaide.com/wife-gang-bang-gang-milf.html .
Hello, here some informatino that might interest you: <br> <br>- <a href=http://www.lowest-rates-mortgages.com/ title=Mortgage alt=Mortgage>Mortgage</a> - <a href=http://www.lowest-rates-mortgages.com/ title=Mortgage alt=Mortgage>http://www.lowest-rates-mortgages.com/</a> <br>- <a href=http://www.lowest-rates-mortgages.com/mortgages title=Mortgages alt=Mortgages>Mortgages</a> - <a href=http://www.lowest-rates-mortgages.com/mortgages title=Mortgages alt=Mortgages>http://www.lowest-rates-mortgages.com/mortgages</a> <br>- <a href=http://www.lowest-rates-mortgages.com/refinancemortgage title=refinance mortgage alt=refinance mortgage>Refinance mortgage</a> - <a href=http://www.lowest-rates-mortgages.com/refinancemortgage title=refinance mortgage alt=refinance mortgage>http://www.lowest-rates-mortgages.com/refinancemortgage</a> <br>- <a href=http://www.lowest-rates-mortgages.com/refinancemortgages title=Refinance mortgages alt=Refinance mortgages>Refinance mortgages</a> - <a href=http://www.lowest-rates-mortgages.com/refinancemortgages title=Refinance mortgages alt=Refinance mortgages>http://www.lowest-rates-mortgages.com/refinancemortgages</a> <br>- <a href=http://www.Choose-online-university.com/ title=online university alt=online university>Online university</a> - <a href=http://www.Choose-online-university.com/ title=online university alt=online university>http://www.Choose-online-university.com/</a> <br>- <a href=http://www.Choose-online-university.com/onlinedegree title=Online degree alt=online degree>Online degree</a> - <a href=http://www.Choose-online-university.com/onlinedegree title=Online degree alt=online degree>http://www.Choose-online-university.com/onlinedegree</a> <br>- <a href=http://www.Choose-online-university.com/onlineuniversities title=Online universities alt=online universities>Online universities</a> - <a href=http://www.Choose-online-university.com/onlineuniversities title=Online universities alt=online universities>http://www.Choose-online-university.com/onlineuniversities</a> <br>- <a href=http://www.Choose-online-university.com/onlinedegrees title=Online degrees alt=online degrees>Online degrees</a> - <a href=http://www.Choose-online-university.com/onlinedegrees title=Online degrees alt=online degrees>http://www.Choose-online-university.com/onlinedegrees</a> <br>- <a href=http://www.Choose-online-university.com/onlineeducation title=Online education alt=online education>Online education</a> - <a href=http://www.Choose-online-university.com/onlineeducation title=Online education alt=online education>http://www.Choose-online-university.com/onlineeducation</a> <br>- <a href=http://www.Choose-online-university.com/AIUonline title=AIUonline? alt=AIUonline?>AIUonline?</a> - <a href=http://www.Choose-online-university.com/AIUonline title=AIUonline? alt=AIUonline?>http://www.Choose-online-university.com/AIUonline</a> <br>- <a href=http://www.Choose-online-university.com/devrycollege. title=Devry college alt=Devry college>Devry College</a> - <a href=http://www.Choose-online-university.com/devrycollege. title=Devry college alt=Devry college>http://www.Choose-online-university.com/devrycollege.</a> <br>- <a href=http://www.Choose-online-university.com/UniversityofPhoenix title=University of Phoenix alt=University of Phoenix>University of Phoenix</a> - <a href=http://www.Choose-online-university.com/UniversityofPhoenix title=University of Phoenix alt=University of Phoenix>http://www.Choose-online-university.com/UniversityofPhoenix</a> <br>- <a href=http://www.forex-online-now.com/foreignexchange title=Foreign exchange alt=Foreign exchange>Foreign exchange</a> - <a href=http://www.forex-online-now.com/foreignexchange title=Foreign exchange alt=Foreign exchange>http://www.forex-online-now.com/foreignexchange</a> <br>- <a href=http://www.forex-online-now.com/ title=forex alt=forex>Forex</a> - <a href=http://www.forex-online-now.com/ title=forex alt=forex>http://www.forex-online-now.com/</a> <br>- <a href=http://www.forex-online-now.com/forextrading title=Forex trading alt=Forex trading>forex trading</a> - <a href=http://www.forex-online-now.com/forextrading title=Forex trading alt=Forex trading>http://www.forex-online-now.com/forextrading</a> <br>- <a href=http://www.apply-to-green-card.org title=Green Card alt=Green Card>Green Card</a> - <a href=http://www.apply-to-green-card.org title=Green Card alt=Green Card>http://www.apply-to-green-card.org</a> <br>- <a href=http://www.CHEAPEST-DUTYFREE-CIGARETTES.COM/ title=cigarettes alt=Cigarettes>Cigarettes</a> - <a href=http://www.CHEAPEST-DUTYFREE-CIGARETTES.COM/ title=cigarettes alt=Cigarettes>http://www.CHEAPEST-DUTYFREE-CIGARETTES.COM/</a> <br>- <a href=http://www.CHEAPEST-DUTYFREE-CIGARETTES.COM/cigarette title=cigarette alt=Cigarette>Cigarette</a> - <a href=http://www.CHEAPEST-DUTYFREE-CIGARETTES.COM/cigarette title=cigarette alt=Cigarette>http://www.CHEAPEST-DUTYFREE-CIGARETTES.COM/cigarette</a> <br>- <a href=http://www.CHEAPEST-DUTYFREE-CIGARETTES.COM/cheapcigarettes title=Cheap cigarettes alt=Cheap cigarettes>Cheap cigarettes</a> - <a href=http://www.CHEAPEST-DUTYFREE-CIGARETTES.COM/cheapcigarettes title=Cheap cigarettes alt=Cheap cigarettes>http://www.CHEAPEST-DUTYFREE-CIGARETTES.COM/cheapcigarettes</a> <br>- <a href=http://www.SPYWARE-REMOVAL-ONLINE.COM/ title=Spyware alt=Spyware>Spyware</a> - <a href=http://www.SPYWARE-REMOVAL-ONLINE.COM/ title=Spyware alt=Spyware>http://www.SPYWARE-REMOVAL-ONLINE.COM/</a> <br>- <a href=http://www.SPYWARE-REMOVAL-ONLINE.COM/spywareremoval title=Spyware removal alt=Spyware removal>Spyware removal</a> - <a href=http://www.SPYWARE-REMOVAL-ONLINE.COM/spywareremoval title=Spyware removal alt=Spyware removal>http://www.SPYWARE-REMOVAL-ONLINE.COM/spywareremoval</a> <br> - <a href=http://www.EASY-HOSTING-SERVICES.COM/ title=Web hosting alt=Web hosting>Web hosting</a> - <a href=http://www.EASY-HOSTING-SERVICES.COM/ title=Web hosting alt=Web hosting>http://www.EASY-HOSTING-SERVICES.COM/</a> <br>- <a href=http://www.EASY-HOSTING-SERVICES.COM/hosting title=Hosting alt=Hosting>Hosting</a> - <a href=http://www.EASY-HOSTING-SERVICES.COM/hosting title=Hosting alt=Hosting>http://www.EASY-HOSTING-SERVICES.COM/hosting</a> <br>- <a href=http://www.EASY-HOSTING-SERVICES.COM/domainhosting title=domain hosting alt=domain hosting>Domain hosting</a> - <a href=http://www.EASY-HOSTING-SERVICES.COM/domainhosting title=domain hosting alt=domain hosting>http://www.EASY-HOSTING-SERVICES.COM/domainhosting</a> <br>- <a href=http://www.EASY-HOSTING-SERVICES.COM/sitehosting title=site hosting alt=site hosting>site hosting</a> - <a href=http://www.EASY-HOSTING-SERVICES.COM/sitehosting title=site hosting alt=site hosting>http://www.EASY-HOSTING-SERVICES.COM/sitehosting</a> <br>- <a href=http://www.MY-DATING-PORTAL.COM/ title=Online dating alt=Online dating>Online dating</a> - <a href=http://www.MY-DATING-PORTAL.COM/ title=Online dating alt=Online dating>http://www.MY-DATING-PORTAL.COM/</a> <br>- <a href=http://www.MY-DATING-PORTAL.COM/dating title=dating alt=Dating>Dating</a> - <a href=http://www.MY-DATING-PORTAL.COM/dating title=dating alt=Dating>http://www.MY-DATING-PORTAL.COM/dating</a> <br> - <a href=http://www.MY-DATING-PORTAL.COM/datingservice title=dating service alt=Dating service>Dating service</a> - <a href=http://www.MY-DATING-PORTAL.COM/datingservice title=dating service alt=Dating service>http://www.MY-DATING-PORTAL.COM/datingservice</a> <br>- <a href=http://www.WORLD-BEST-POKER-ONLINE.COM/ title=Poker alt=Poker>Poker</a> - <a href=http://www.WORLD-BEST-POKER-ONLINE.COM/ title=Poker alt=Poker>http://www.WORLD-BEST-POKER-ONLINE.COM/</a> <br>- <a href=http://www.WORLD-BEST-POKER-ONLINE.COM/onlinepoker title=online poker alt=online poker>Online poker</a> - <a href=http://www.WORLD-BEST-POKER-ONLINE.COM/onlinepoker title=online poker alt=online poker>http://www.WORLD-BEST-POKER-ONLINE.COM/onlinepoker</a> <br> - <a href=http://www.WORLD-BEST-POKER-ONLINE.COM/pokerroom title=poker room alt=poker room>Poker room</a> - <a href=http://www.WORLD-BEST-POKER-ONLINE.COM/pokerroom title=poker room alt=poker room>http://www.WORLD-BEST-POKER-ONLINE.COM/pokerroom</a> <br>
Io language notes
Io is a small, well-designed and efficient scripting language created in 2002 by Steve Dekorte. Io is particularily pleasant because it has a rather clean, regular syntax that frees us from the ugly C-style braces and trailing semicolons, pretty much like an hybrid of Python and Lisp. Io also offers very high level language traits that condense much of the advances made in scripting years since the 90s.
Io notably introduces some interesting perspectives and features such as prototype-based inhertiance, asynchronous execution operator, or full reflectivity.
Io language main site is available at http://www.iolanguage.com, Steve's page is available at http://www.dekorte.com. There is also the main Io wiki available at http://io.kicks-ass.net/FrontPage.
Related pages:
- QuestionsAndAnswers, questions and answers that came on the Io mailing list
- {{Gotchas}}, a page that tries to collect common gotchas for Io newbies
- PrototypesVsClasses, compares the prototype-based inheritance to the class-based inheritance
- ObjcBridge, introduces the bridge that allows cross-integration of Io and Objective-C.
- ModuleSystem, a draft for a module/package system for Io
- DocumentationSystem, a draft for a documentation system for Io
- IoUnit, a simple automated testing framework for Io
1. A quick glance at Io
Here is an Object-oriented "Hello World" written in Io:
HelloObject = Object clone
HelloObject sayHello = method(
"Hello World!" print
)
HelloObject sayHello()
You can check out some more Io examples here http://www.iolanguage.com/SampleCode.html.
2. Io language traits
Now that the impatient was fed with some source code, I will introduce Io from a more theorical point of view and expose the traits (a.k.a. the language features) that make it such a pleasant beast:
- Prototype-based inheritance: Inheritance in IO is realised by cloning objects and maintaining a dynamic relation between the clone and the original.
- Purely Object-Oriented: all entities that are manipulated in Io derive from the same Object prototype.
- Garbage-collected: objects are automatically allocated and deallocated.
- Dynamically typed: although Io has a notion of type, variables are untyped and operations prototypes do not carry type information. Some type checks can be made using generally available methods.
- Strongly typed: all interactions are through messages to object. Memory is never accessed directly.
- Interpreted: Io source code is not compiled to bytecode but rather read and converted to an in-memory representation.
- Code as data: blocks of code are reified into objects, which can be modified and dynamically created.
- Reflective: as a consequence of the "code as data", it is possible to investigate the properties of any Io object at runtime, including its source code.
- Dynamic: because code is data (and vice-versa), it is possible to change a program logic during its execution. It is of course also possible to dynamically modify an object attributes and operations at runtime. Combined with the prototype-based inheritance, this allows to dynamically "change an object class".
Although Io shares some traits with functional languages, Io could be considered as a member of the imperative family of languages. However, Io dynamicity and deep reflectivity enables programming styles that are not usually possible with other languages from the imperative family.
I consider Io as a very interesting language for scripting existing applications, while I would rather advice the use of a statically, strongly typed language for the application core. Io has a simple syntax, is very flexible and powerful, but lacks some features of more mature languages, such as Python:
- Io does not offer a module/package system
- There is no code documentation tool (e.g. JavaDoc?, POD, PyDoc?, etc)
- There are no type-checking/object utilities (interfaces)
Io is constently evoloving, and Steve is rather open to comments, as proved the improvement of the VM toward a single-rooted object hierarchy (primitives used to inherit from IoValue?, and Object was a primitive) undergone in June 2003. In this respect, this small disadvantages will be surely be resolved in the future. In the meantime, Io is really fun to play with, and is a perfect language to be embedded in an application (especially Objective-C apps ;).
3. Io terminology
To have a better understanding of the different terms encountered in Io documentation and in the Io mailing list, here is a short list of terms with their accompanying definition:
- Prototype: a prototype is an object that can be cloned. The link between a clone and its prototype is very close to the link between a class and an instance. Clones will resolve attributes and operations that are not locally defined in their prototype. If this sounds abstract, you can think of prototypes as classes that you could create and manipulate just as other objects.
- Slot: a slot is an object part that allows to bind values to names. Slots can be considered as a name --> value mapping belonging to a particular object. Attributes and operations are first resolved in an object slot.
- Actor: First introduced by Carl Hewitt in his PLANNER paper of 1969, the concept of an actor is equivalent to an active object (thread) that would asynchronously process received messages (like operations). In Gul Agha actor model, messages are first queued in a FIFO attached to the object, and sequentially processed.
- Asynchronous message: when an object (sender) sends a message to another object (receiver), the sender usually waits for the sender to receive the message, process it and send a response (indicating the message was processed, optionally with a return value). This is called synchronous communication, when sending is a blocking act for the sender. With asynchronous messages, the sender simply sends the message, but do not wait for the response, enable it to continue to act while the message is processed by the receiver.
- Future: also know as "promise" a Future is an encapsulation of the future response message (actually response value) to an asynchronous message. A future enables objects to reference a value that is not yet computed.
Note: Maybe also exlain continuation, scope, resolution, tag, typed and untyped, reflectivity, etc.
Recommendend readings:
- Reactive objects by Joan Nordlander
- Lambda the Ultimate
4. Io object model
Io is a purely object-oriented language, which means that everything is an object. Many object languages that derive from the C family are not able to manipulate primitive types (integers, floats, etc) consistently with object. Io has a single primitive: the Object. In this respect, the dynamic properties of objects are available for all entities in Io.
Definition of a message Prototype based Values, Primitives and Objects Mechanisms involved in responsing to a message Messaging model
Io has the very appreciable feature of accessing the object that sent a message to the receiving object. This allows to modify the behaviour of the receiving object according to the type of the invoking object. The sender object is accessible using the "sender" slot of the receiving object.
5. Understanding Io concepts
Io is based on some concepts that may not be familiar to people used to common programming languages such as C, C++ or Java. At first, Io is inspired by the following kinds of languages:
- Prototype-based language: languages that realise inheritance by cloning object rather than instanciating them from a class.
- Actor language: languages that consider objects to be dynamic and to communicate with messages
- Functional languages: languages that provide a lambda-like operator, either closure or blocks.
Don't be afraid if you don't know the languages or understand my short presentation, this will be explained here.
A. Types and Protoypes
Even if types and prototypes share the same "types" suffix, they both represent different things. A type qualifies and categories a given value, while a prototype is already a value.
Most programming languages allow to define new types ; in object-oriented programming, new types are defined with classes. Classes can be considered as a model that will be reproduced by the instances, the reproduction of the model is done by the class constructor operations. The main problem with classes is that they may not be referencable or accessible (if the language is not reflexive like C++, unlike Java), and that it is definitely not possible to modify them at runtime.
Prototypes allow to do the same as defining new types through classes: instead of describing a class, we construct an object that will serve as the actual model for future "instances". The equivalent operation to creating an instance is simply to "clone" the prototype. This language trait allow to freely manipulate prototype, which is not always possible with classes (though a fully reflexive non-prototype language would certainly exhibit the same features).
The idea behind prototypes (which could also be called "stereotype") is that you build a collection of predefined objects that will serve as a basis for all object that will be based on them. Prototype is a very interesting way to weave objets together.
A good thing would also be to have a look at this page http://www.wikipedia.org/wiki/Prototype_based.
B. Types and Tags
Tag in Io are inspired from Lua typing system [2], a tag specifies a given type. For instance, a Lua function could be either implemented in Lua or in C. To make the difference between both functions (which are considered as first-class language citizens, ie. values) the tag is used to indicate wether the function is in C or in Lua. Tags can then be considered as a sub-type.
Tags are useful for customising Io because they allow to extend or redefine the behaviour of a specific type, like for instance redefine how a list would react the add or remove messages.
Steve gives the following explaination on tags :
Every value is a primitive of some sort - a String, List, Objects, etc. And the data structure for each primitive begins with "mark" and "tag" members.
Example:
typedef struct { IoMark? mark; Tag *tag; ByteArray? *byteArray; } IoString?;
The mark is for garbage collection purposes and the tag is a reference the primitive's tag datastructure. The tag is used to figure out which C function to call for a given operation on a value. For example, when the garbage collector decides to free the IoString??, it ends up looking in the IoString??'s tag and finds the freeFunc function pointer and calls it. This function pointer is set to IoString?_free. The freeFunc function pointer in a tag for a different primitive would would be set to a different C function. This makes it easier for people to externally add new primitves.
Links:
- [2] See Lua 4.http://www.lua.org/manual/4.0/manual.html manual in sections 3 and 4, at http://www.lua.org/manual/4.0/manual.html. They provide a great
explaination on how tags can be used.
C. Reflectivity
Io is an intrinsically open language, as it offers very powerful reflexive features. One of the interesting features is that Io stores the whole program as a tree that mirrors the source code. This tree is not compiled to bytecode, but is rather directly executed.
One of the side effects of this choice is that you can get the source code at anytime. For instance, any Io object can output its source code. This is a truely interesting feature from an open-source development perspective, which recalls me the power of categories in Objective-C.
D. Language constructs reification
The combination of tags and reflexivity grants Io with very powerful self-modifications features, such as redefining the behaviour of executing a block value. Here is a Io code snippet that substitutes the default block activation function with a new one:
IoTag? *tag = IoState?_tagWithInitFunction_(ioState, StateTagInit?*)IoBlock?_initTagWithId_); tag->activationFunc = MyBlockActivationFunc?;
then in the activation function, you can do what you want:
IoValue? * MyBlockActivationFunc?(IoBlock? *self, IoObject? *target, IoObject? *locals, IoMessage? *m) { /* Do what I want */ /* And call the normal IoBlock? activation function */ IoBlock?_target_locals_call_(self, target, locals, m); }
[ Note that this example was given by Steve on the Io mailing-list]
I'm not sure if this is the right term for qualifying this, but to me, language reification means that the language internal mechanism is reified so as to be able to reprogram the language with the language itself (or through the use of simple extensions in C).
See http://www.wikipedia.org/wiki/Dynamic_typing
Comments
Feel free to add comments on this document.
Io language notes
Io is a small, well-designed and efficient scripting language created in 2002 by Steve Dekorte. Io is particularily pleasant because it has a rather clean, regular syntax that frees us from the ugly C-style braces and trailing semicolons, pretty much like an hybrid of Python and Lisp. Io also offers very high level language traits that condense much of the advances made in scripting years since the 90s.
Io notably introduces some interesting perspectives and features such as prototype-based inhertiance, asynchronous execution operator, or full reflectivity.
Io language main site is available at http://www.iolanguage.com, Steve's page is available at http://www.dekorte.com. There is also the main Io wiki available at http://io.kicks-ass.net/FrontPage.
Related pages:
- QuestionsAndAnswers, questions and answers that came on the Io mailing list
- {{Gotchas}}, a page that tries to collect common gotchas for Io newbies
- PrototypesVsClasses, compares the prototype-based inheritance to the class-based inheritance
- ObjcBridge, introduces the bridge that allows cross-integration of Io and Objective-C.
- ModuleSystem, a draft for a module/package system for Io
- DocumentationSystem, a draft for a documentation system for Io
- IoUnit, a simple automated testing framework for Io
1. A quick glance at Io
Here's is a basic "Hello World" written in Io:
write("Hello World\n")
And here is an Object-oriented "Hello World" written in Io:
HelloObject := Object clone
HelloObject sayHello := method(
"Hello World!" print
)
HelloObject sayHello()
You can check out some more Io examples here http://www.iolanguage.com/SampleCode.html.
2. Io language traits
Now that the impatient was fed with some source code, I will introduce Io from a more theoretical point of view and expose the traits (a.k.a. the language features) that make it such a pleasant beast:
- Prototype-based inheritance: Inheritance in IO is realised by cloning objects and maintaining a dynamic relation between the clone and the original.
- Message-oriented: all interactions in Io are made through messages, which are the equivalent of function and method calls in other languages. Messages are also reified into the languages, which allows to manipulate them as any other object.
- Purely Object-Oriented: all entities that are manipulated in Io derive from the same Object prototype.
- Garbage-collected: objects are automatically allocated and deallocated.
- Dynamically typed: although Io has a notion of type, variables are untyped and operations prototypes do not carry type information. Some type checks can be made using generally available methods.
- Interpreted: Io source code is not compiled to bytecode but rather read and converted to an in-memory representation.
- Code as data: blocks of code are reified into objects, which can be modified and dynamically created.
- Reflective: as a consequence of the "code as data", it is possible to investigate the properties of any Io object at runtime, including its source code.
- Dynamic: because code is data (and vice-versa), it is possible to change a program logic during its execution. It is of course also possible to dynamically modify an object attributes and operations at runtime. Combined with the prototype-based inheritance, this allows to dynamically "change an object class".
Although Io shares some traits with functional languages, Io could be considered as a member of the imperative family of languages. However, Io dynamicity and deep reflectivity enables programming styles that are not usually possible with other languages from the imperative family.
I consider Io as a very interesting language for scripting existing applications, while I would rather advice the use of a statically, strongly typed language for the application core. Io has a simple syntax, is very flexible and powerful, but lacks some features of more mature languages, such as Python:
- Io does not offer a module/package system
- There is no code documentation tool (e.g. JavaDoc?, POD, PyDoc?, etc)
- There are no type-checking/object utilities (interfaces)
Io is constently evoloving, and Steve is rather open to comments, as proved the improvement of the VM toward a single-rooted object hierarchy (primitives used to inherit from IoValue?, and Object was a primitive) undergone in June 2003. In this respect, this small disadvantages will be surely be resolved in the future. In the meantime, Io is really fun to play with, and is a perfect language to be embedded in an application (especially Objective-C apps ;).
3. Io terminology
To have a better understanding of the different terms encountered in Io documentation and in the Io mailing list, here is a short list of terms with their accompanying definition:
- Prototype: a prototype is an object that can be cloned. The link between a clone and its prototype is very close to the link between a class and an instance. Clones will resolve attributes and operations that are not locally defined in their prototype. If this sounds abstract, you can think of prototypes as classes that you could create and manipulate just as other objects.
- Slot: a slot is an object part that allows to bind values to names. Slots can be considered as a name --> value mapping belonging to a particular object. Attributes and operations are first resolved in an object slot. For Pythonistas, a slot is the equivalent of an entry in a hash table.
- Actor: First introduced by Carl Hewitt in his PLANNER paper of 1969, the concept of an actor is equivalent to an active object (thread) that would asynchronously process received messages (like operations). In Gul Agha actor model, messages are first queued in a FIFO attached to the object, and then sequentially processed. Actors are sometimes refered to as active objects, and even agents, though the use of this term is controversial.
- Asynchronous message: when an object (sender) sends a message to another object (receiver), the sender usually waits for the sender to receive the message, process it and send a response (indicating the message was processed, optionally with a return value). This is called synchronous communication, when sending is a blocking act for the sender. With asynchronous messages, the sender simply sends the message, but do not wait for the response, enable it to continue to act while the message is processed by the receiver.
- Future: also know as "promise" a Future is an encapsulation of the future response message (actually response value) to an asynchronous message. A future enables objects to reference a value that is not yet computed.
Note: Maybe also exlain continuation, scope, resolution, tag, typed and untyped, reflectivity, etc.
Recommendend readings:
- Reactive objects by Joan Nordlander
- http://lambda.weblogs.com Lambda the Ultimate
4. Io object model
Io is a purely object-oriented language, which means that everything is an object. Many object languages that derive from the C family are not able to manipulate primitive types (integers, floats, etc) consistently with object. Io has a single primitive: the Object. In this respect, the dynamic properties of objects are available for all entities in Io.
Definition of a message Prototype based Values, Primitives and Objects Mechanisms involved in responsing to a message Messaging model
Io has the very appreciable feature of accessing the object that sent a message to the receiving object. This allows to modify the behaviour of the receiving object according to the type of the invoking object. The sender object is accessible using the "sender" slot of the receiving object.
5. Understanding Io concepts
Io is based on some concepts that may not be familiar to people used to common programming languages such as C, C++ or Java. At first, Io is inspired by the following kinds of languages:
- Prototype-based language: languages that realise inheritance by cloning object rather than instanciating them from a class.
- Actor language: languages that consider objects to be dynamic and to communicate with messages
- Functional languages: languages that provide a lambda-like operator, either closure or blocks.
Don't be afraid if you don't know the languages or understand my short presentation, this will be explained here.
A. Types and Protoypes
Even if types and prototypes share the same "types" suffix, they both represent different things. A type qualifies and categories a given value, while a prototype is already a value.
Most programming languages allow to define new types ; in object-oriented programming, new types are defined with classes. Classes can be considered as a model that will be reproduced by the instances, the reproduction of the model is done by the class constructor operations. The main problem with classes is that they may not be referencable or accessible (if the language is not reflexive like C++, unlike Java), and that it is definitely not possible to modify them at runtime.
Prototypes allow to do the same as defining new types through classes: instead of describing a class, we construct an object that will serve as the actual model for future "instances". The equivalent operation to creating an instance is simply to "clone" the prototype. This language trait allow to freely manipulate prototype, which is not always possible with classes (though a fully reflexive non-prototype language would certainly exhibit the same features).
The idea behind prototypes (which could also be called "stereotype") is that you build a collection of predefined objects that will serve as a basis for all object that will be based on them. Prototype is a very interesting way to weave objets together.
A good thing would also be to have a look at this page http://www.wikipedia.org/wiki/Prototype_based.
B. Types and Tags
Tag in Io are inspired from Lua typing system [2], a tag specifies a given type. For instance, a Lua function could be either implemented in Lua or in C. To make the difference between both functions (which are considered as first-class language citizens, ie. values) the tag is used to indicate wether the function is in C or in Lua. Tags can then be considered as a sub-type.
Tags are useful for customising Io because they allow to extend or redefine the behaviour of a specific type, like for instance redefine how a list would react the add or remove messages.
Steve gives the following explaination on tags :
Every value is a primitive of some sort - a String, List, Objects, etc. And the data structure for each primitive begins with "mark" and "tag" members.
Example:
typedef struct { IoMark? mark; Tag *tag; ByteArray? *byteArray; } IoString?;
The mark is for garbage collection purposes and the tag is a reference the primitive's tag datastructure. The tag is used to figure out which C function to call for a given operation on a value. For example, when the garbage collector decides to free the IoString??, it ends up looking in the IoString??'s tag and finds the freeFunc function pointer and calls it. This function pointer is set to IoString?_free. The freeFunc function pointer in a tag for a different primitive would would be set to a different C function. This makes it easier for people to externally add new primitves.
Links:
- [2] See Lua 4.http://www.lua.org/manual/4.0/manual.html manual in sections 3 and 4, at http://www.lua.org/manual/4.0/manual.html. They provide a great
explaination on how tags can be used.
C. Reflectivity
Io is an intrinsically open language, as it offers very powerful reflexive features. One of the interesting features is that Io stores the whole program as a tree that mirrors the source code. This tree is not compiled to bytecode, but is rather directly executed.
One of the side effects of this choice is that you can get the source code at anytime. For instance, any Io object can output its source code. This is a truely interesting feature from an open-source development perspective, which recalls me the power of categories in Objective-C.
D. Language constructs reification
The combination of tags and reflexivity grants Io with very powerful self-modifications features, such as redefining the behaviour of executing a block value. Here is a Io code snippet that substitutes the default block activation function with a new one:
IoTag? *tag = IoState?_tagWithInitFunction_(ioState, StateTagInit?*)IoBlock?_initTagWithId_); tag->activationFunc = MyBlockActivationFunc?;
then in the activation function, you can do what you want:
IoValue? * MyBlockActivationFunc?(IoBlock? *self, IoObject? *target, IoObject? *locals, IoMessage? *m) { /* Do what I want */ /* And call the normal IoBlock? activation function */ IoBlock?_target_locals_call_(self, target, locals, m); }
[ Note that this example was given by Steve on the Io mailing-list]
I'm not sure if this is the right term for qualifying this, but to me, language reification means that the language internal mechanism is reified so as to be able to reprogram the language with the language itself (or through the use of simple extensions in C).
See http://www.wikipedia.org/wiki/Dynamic_typing
Comments
Feel free to add comments on this document.
Hello, here some informatino that might interest you: <br> <br>- <a href=http://www.lowest-rates-mortgages.com/ title=Mortgage alt=Mortgage>Mortgage</a> - <a href=http://www.lowest-rates-mortgages.com/ title=Mortgage alt=Mortgage>http://www.lowest-rates-mortgages.com/</a> <br>- <a href=http://www.lowest-rates-mortgages.com/mortgages title=Mortgages alt=Mortgages>Mortgages</a> - <a href=http://www.lowest-rates-mortgages.com/mortgages title=Mortgages alt=Mortgages>http://www.lowest-rates-mortgages.com/mortgages</a> <br>- <a href=http://www.lowest-rates-mortgages.com/refinancemortgage title=refinance mortgage alt=refinance mortgage>Refinance mortgage</a> - <a href=http://www.lowest-rates-mortgages.com/refinancemortgage title=refinance mortgage alt=refinance mortgage>http://www.lowest-rates-mortgages.com/refinancemortgage</a> <br>- <a href=http://www.lowest-rates-mortgages.com/refinancemortgages title=Refinance mortgages alt=Refinance mortgages>Refinance mortgages</a> - <a href=http://www.lowest-rates-mortgages.com/refinancemortgages title=Refinance mortgages alt=Refinance mortgages>http://www.lowest-rates-mortgages.com/refinancemortgages</a> <br>- <a href=http://www.Choose-online-university.com/ title=online university alt=online university>Online university</a> - <a href=http://www.Choose-online-university.com/ title=online university alt=online university>http://www.Choose-online-university.com/</a> <br>- <a href=http://www.Choose-online-university.com/onlinedegree title=Online degree alt=online degree>Online degree</a> - <a href=http://www.Choose-online-university.com/onlinedegree title=Online degree alt=online degree>http://www.Choose-online-university.com/onlinedegree</a> <br>- <a href=http://www.Choose-online-university.com/onlineuniversities title=Online universities alt=online universities>Online universities</a> - <a href=http://www.Choose-online-university.com/onlineuniversities title=Online universities alt=online universities>http://www.Choose-online-university.com/onlineuniversities</a> <br>- <a href=http://www.Choose-online-university.com/onlinedegrees title=Online degrees alt=online degrees>Online degrees</a> - <a href=http://www.Choose-online-university.com/onlinedegrees title=Online degrees alt=online degrees>http://www.Choose-online-university.com/onlinedegrees</a> <br>- <a href=http://www.Choose-online-university.com/onlineeducation title=Online education alt=online education>Online education</a> - <a href=http://www.Choose-online-university.com/onlineeducation title=Online education alt=online education>http://www.Choose-online-university.com/onlineeducation</a> <br>- <a href=http://www.Choose-online-university.com/AIUonline title=AIUonline? alt=AIUonline?>AIUonline?</a> - <a href=http://www.Choose-online-university.com/AIUonline title=AIUonline? alt=AIUonline?>http://www.Choose-online-university.com/AIUonline</a> <br>- <a href=http://www.Choose-online-university.com/devrycollege. title=Devry college alt=Devry college>Devry College</a> - <a href=http://www.Choose-online-university.com/devrycollege. title=Devry college alt=Devry college>http://www.Choose-online-university.com/devrycollege.</a> <br>- <a href=http://www.Choose-online-university.com/UniversityofPhoenix title=University of Phoenix alt=University of Phoenix>University of Phoenix</a> - <a href=http://www.Choose-online-university.com/UniversityofPhoenix title=University of Phoenix alt=University of Phoenix>http://www.Choose-online-university.com/UniversityofPhoenix</a> <br>- <a href=http://www.forex-online-now.com/foreignexchange title=Foreign exchange alt=Foreign exchange>Foreign exchange</a> - <a href=http://www.forex-online-now.com/foreignexchange title=Foreign exchange alt=Foreign exchange>http://www.forex-online-now.com/foreignexchange</a> <br>- <a href=http://www.forex-online-now.com/ title=forex alt=forex>Forex</a> - <a href=http://www.forex-online-now.com/ title=forex alt=forex>http://www.forex-online-now.com/</a> <br>- <a href=http://www.forex-online-now.com/forextrading title=Forex trading alt=Forex trading>forex trading</a> - <a href=http://www.forex-online-now.com/forextrading title=Forex trading alt=Forex trading>http://www.forex-online-now.com/forextrading</a> <br>- <a href=http://www.apply-to-green-card.org title=Green Card alt=Green Card>Green Card</a> - <a href=http://www.apply-to-green-card.org title=Green Card alt=Green Card>http://www.apply-to-green-card.org</a> <br>- <a href=http://www.CHEAPEST-DUTYFREE-CIGARETTES.COM/ title=cigarettes alt=Cigarettes>Cigarettes</a> - <a href=http://www.CHEAPEST-DUTYFREE-CIGARETTES.COM/ title=cigarettes alt=Cigarettes>http://www.CHEAPEST-DUTYFREE-CIGARETTES.COM/</a> <br>- <a href=http://www.CHEAPEST-DUTYFREE-CIGARETTES.COM/cigarette title=cigarette alt=Cigarette>Cigarette</a> - <a href=http://www.CHEAPEST-DUTYFREE-CIGARETTES.COM/cigarette title=cigarette alt=Cigarette>http://www.CHEAPEST-DUTYFREE-CIGARETTES.COM/cigarette</a> <br>- <a href=http://www.CHEAPEST-DUTYFREE-CIGARETTES.COM/cheapcigarettes title=Cheap cigarettes alt=Cheap cigarettes>Cheap cigarettes</a> - <a href=http://www.CHEAPEST-DUTYFREE-CIGARETTES.COM/cheapcigarettes title=Cheap cigarettes alt=Cheap cigarettes>http://www.CHEAPEST-DUTYFREE-CIGARETTES.COM/cheapcigarettes</a> <br>- <a href=http://www.SPYWARE-REMOVAL-ONLINE.COM/ title=Spyware alt=Spyware>Spyware</a> - <a href=http://www.SPYWARE-REMOVAL-ONLINE.COM/ title=Spyware alt=Spyware>http://www.SPYWARE-REMOVAL-ONLINE.COM/</a> <br>- <a href=http://www.SPYWARE-REMOVAL-ONLINE.COM/spywareremoval title=Spyware removal alt=Spyware removal>Spyware removal</a> - <a href=http://www.SPYWARE-REMOVAL-ONLINE.COM/spywareremoval title=Spyware removal alt=Spyware removal>http://www.SPYWARE-REMOVAL-ONLINE.COM/spywareremoval</a> <br> - <a href=http://www.EASY-HOSTING-SERVICES.COM/ title=Web hosting alt=Web hosting>Web hosting</a> - <a href=http://www.EASY-HOSTING-SERVICES.COM/ title=Web hosting alt=Web hosting>http://www.EASY-HOSTING-SERVICES.COM/</a> <br>- <a href=http://www.EASY-HOSTING-SERVICES.COM/hosting title=Hosting alt=Hosting>Hosting</a> - <a href=http://www.EASY-HOSTING-SERVICES.COM/hosting title=Hosting alt=Hosting>http://www.EASY-HOSTING-SERVICES.COM/hosting</a> <br>- <a href=http://www.EASY-HOSTING-SERVICES.COM/domainhosting title=domain hosting alt=domain hosting>Domain hosting</a> - <a href=http://www.EASY-HOSTING-SERVICES.COM/domainhosting title=domain hosting alt=domain hosting>http://www.EASY-HOSTING-SERVICES.COM/domainhosting</a> <br>- <a href=http://www.EASY-HOSTING-SERVICES.COM/sitehosting title=site hosting alt=site hosting>site hosting</a> - <a href=http://www.EASY-HOSTING-SERVICES.COM/sitehosting title=site hosting alt=site hosting>http://www.EASY-HOSTING-SERVICES.COM/sitehosting</a> <br>- <a href=http://www.MY-DATING-PORTAL.COM/ title=Online dating alt=Online dating>Online dating</a> - <a href=http://www.MY-DATING-PORTAL.COM/ title=Online dating alt=Online dating>http://www.MY-DATING-PORTAL.COM/</a> <br>- <a href=http://www.MY-DATING-PORTAL.COM/dating title=dating alt=Dating>Dating</a> - <a href=http://www.MY-DATING-PORTAL.COM/dating title=dating alt=Dating>http://www.MY-DATING-PORTAL.COM/dating</a> <br> - <a href=http://www.MY-DATING-PORTAL.COM/datingservice title=dating service alt=Dating service>Dating service</a> - <a href=http://www.MY-DATING-PORTAL.COM/datingservice title=dating service alt=Dating service>http://www.MY-DATING-PORTAL.COM/datingservice</a> <br>- <a href=http://www.WORLD-BEST-POKER-ONLINE.COM/ title=Poker alt=Poker>Poker</a> - <a href=http://www.WORLD-BEST-POKER-ONLINE.COM/ title=Poker alt=Poker>http://www.WORLD-BEST-POKER-ONLINE.COM/</a> <br>- <a href=http://www.WORLD-BEST-POKER-ONLINE.COM/onlinepoker title=online poker alt=online poker>Online poker</a> - <a href=http://www.WORLD-BEST-POKER-ONLINE.COM/onlinepoker title=online poker alt=online poker>http://www.WORLD-BEST-POKER-ONLINE.COM/onlinepoker</a> <br> - <a href=http://www.WORLD-BEST-POKER-ONLINE.COM/pokerroom title=poker room alt=poker room>Poker room</a> - <a href=http://www.WORLD-BEST-POKER-ONLINE.COM/pokerroom title=poker room alt=poker room>http://www.WORLD-BEST-POKER-ONLINE.COM/pokerroom</a> <br>
online casino
Io language notes
Io is a small, well-designed and efficient scripting language created in 2002 by Steve Dekorte. Io is particularily pleasant because it has a rather clean, regular syntax that frees us from the ugly C-style braces and trailing semicolons, pretty much like an hybrid of Python and Lisp. Io also offers very high level language traits that condense much of the advances made in scripting years since the 90s.
Io notably introduces some interesting perspectives and features such as prototype-based inhertiance, asynchronous execution operator, or full reflectivity.
Io language main site is available at http://www.iolanguage.com, Steve's page is available at http://www.dekorte.com. There is also the main Io wiki available at http://io.kicks-ass.net/FrontPage.
Related pages:
- QuestionsAndAnswers, questions and answers that came on the Io mailing list
- {{Gotchas}}, a page that tries to collect common gotchas for Io newbies
- PrototypesVsClasses, compares the prototype-based inheritance to the class-based inheritance
- ObjcBridge, introduces the bridge that allows cross-integration of Io and Objective-C.
- ModuleSystem, a draft for a module/package system for Io
- DocumentationSystem, a draft for a documentation system for Io
- IoUnit, a simple automated testing framework for Io
1. A quick glance at Io
Here's is a basic "Hello World" written in Io:
write("Hello World\n")
And here is an Object-oriented "Hello World" written in Io:
HelloObject := Object clone
HelloObject sayHello := method(
"Hello World!" print
)
HelloObject sayHello()
You can check out some more Io examples here http://www.iolanguage.com/SampleCode.html.
2. Io language traits
Now that the impatient was fed with some source code, I will introduce Io from a more theoretical point of view and expose the traits (a.k.a. the language features) that make it such a pleasant beast:
- Prototype-based inheritance: Inheritance in IO is realised by cloning objects and maintaining a dynamic relation between the clone and the original.
- Message-oriented: all interactions in Io are made through messages, which are the equivalent of function and method calls in other languages. Messages are also reified into the languages, which allows to manipulate them as any other object.
- Purely Object-Oriented: all entities that are manipulated in Io derive from the same Object prototype.
- Garbage-collected: objects are automatically allocated and deallocated.
- Dynamically typed: although Io has a notion of type, variables are untyped and operations prototypes do not carry type information. Some type checks can be made using generally available methods.
- Interpreted: Io source code is not compiled to bytecode but rather read and converted to an in-memory representation.
- Code as data: blocks of code are reified into objects, which can be modified and dynamically created.
- Reflective: as a consequence of the "code as data", it is possible to investigate the properties of any Io object at runtime, including its source code.
- Dynamic: because code is data (and vice-versa), it is possible to change a program logic during its execution. It is of course also possible to dynamically modify an object attributes and operations at runtime. Combined with the prototype-based inheritance, this allows to dynamically "change an object class".
Although Io shares some traits with functional languages, Io could be considered as a member of the imperative family of languages. However, Io dynamicity and deep reflectivity enables programming styles that are not usually possible with other languages from the imperative family.
I consider Io as a very interesting language for scripting existing applications, while I would rather advice the use of a statically, strongly typed language for the application core. Io has a simple syntax, is very flexible and powerful, but lacks some features of more mature languages, such as Python:
- Io does not offer a module/package system
- There is no code documentation tool (e.g. JavaDoc?, POD, PyDoc?, etc)
- There are no type-checking/object utilities (interfaces)
Io is constently evoloving, and Steve is rather open to comments, as proved the improvement of the VM toward a single-rooted object hierarchy (primitives used to inherit from IoValue?, and Object was a primitive) undergone in June 2003. In this respect, this small disadvantages will be surely be resolved in the future. In the meantime, Io is really fun to play with, and is a perfect language to be embedded in an application (especially Objective-C apps ;).
3. Io terminology
To have a better understanding of the different terms encountered in Io documentation and in the Io mailing list, here is a short list of terms with their accompanying definition:
- Prototype: a prototype is an object that can be cloned. The link between a clone and its prototype is very close to the link between a class and an instance. Clones will resolve attributes and operations that are not locally defined in their prototype. If this sounds abstract, you can think of prototypes as classes that you could create and manipulate just as other objects.
- Slot: a slot is an object part that allows to bind values to names. Slots can be considered as a name --> value mapping belonging to a particular object. Attributes and operations are first resolved in an object slot. For Pythonistas, a slot is the equivalent of an entry in a hash table.
- Actor: First introduced by Carl Hewitt in his PLANNER paper of 1969, the concept of an actor is equivalent to an active object (thread) that would asynchronously process received messages (like operations). In Gul Agha actor model, messages are first queued in a FIFO attached to the object, and then sequentially processed. Actors are sometimes refered to as active objects, and even agents, though the use of this term is controversial.
- Asynchronous message: when an object (sender) sends a message to another object (receiver), the sender usually waits for the sender to receive the message, process it and send a response (indicating the message was processed, optionally with a return value). This is called synchronous communication, when sending is a blocking act for the sender. With asynchronous messages, the sender simply sends the message, but do not wait for the response, enable it to continue to act while the message is processed by the receiver.
- Future: also know as "promise" a Future is an encapsulation of the future response message (actually response value) to an asynchronous message. A future enables objects to reference a value that is not yet computed.
Note: Maybe also exlain continuation, scope, resolution, tag, typed and untyped, reflectivity, etc.
Recommendend readings:
- Reactive objects by Joan Nordlander
- http://lambda.weblogs.com Lambda the Ultimate
4. Io object model
Io is a purely object-oriented language, which means that everything is an object. Many object languages that derive from the C family are not able to manipulate primitive types (integers, floats, etc) consistently with object. Io has a single primitive: the Object. In this respect, the dynamic properties of objects are available for all entities in Io.
Definition of a message Prototype based Values, Primitives and Objects Mechanisms involved in responsing to a message Messaging model
Io has the very appreciable feature of accessing the object that sent a message to the receiving object. This allows to modify the behaviour of the receiving object according to the type of the invoking object. The sender object is accessible using the "sender" slot of the receiving object.
5. Understanding Io concepts
Io is based on some concepts that may not be familiar to people used to common programming languages such as C, C++ or Java. At first, Io is inspired by the following kinds of languages:
- Prototype-based language: languages that realise inheritance by cloning object rather than instanciating them from a class.
- Actor language: languages that consider objects to be dynamic and to communicate with messages
- Functional languages: languages that provide a lambda-like operator, either closure or blocks.
Don't be afraid if you don't know the languages or understand my short presentation, this will be explained here.
A. Types and Protoypes
Even if types and prototypes share the same "types" suffix, they both represent different things. A type qualifies and categories a given value, while a prototype is already a value.
Most programming languages allow to define new types ; in object-oriented programming, new types are defined with classes. Classes can be considered as a model that will be reproduced by the instances, the reproduction of the model is done by the class constructor operations. The main problem with classes is that they may not be referencable or accessible (if the language is not reflexive like C++, unlike Java), and that it is definitely not possible to modify them at runtime.
Prototypes allow to do the same as defining new types through classes: instead of describing a class, we construct an object that will serve as the actual model for future "instances". The equivalent operation to creating an instance is simply to "clone" the prototype. This language trait allow to freely manipulate prototype, which is not always possible with classes (though a fully reflexive non-prototype language would certainly exhibit the same features).
The idea behind prototypes (which could also be called "stereotype") is that you build a collection of predefined objects that will serve as a basis for all object that will be based on them. Prototype is a very interesting way to weave objets together.
A good thing would also be to have a look at this page http://www.wikipedia.org/wiki/Prototype_based.
B. Types and Tags
Tag in Io are inspired from Lua typing system [2], a tag specifies a given type. For instance, a Lua function could be either implemented in Lua or in C. To make the difference between both functions (which are considered as first-class language citizens, ie. values) the tag is used to indicate wether the function is in C or in Lua. Tags can then be considered as a sub-type.
Tags are useful for customising Io because they allow to extend or redefine the behaviour of a specific type, like for instance redefine how a list would react the add or remove messages.
Steve gives the following explaination on tags :
Every value is a primitive of some sort - a String, List, Objects, etc. And the data structure for each primitive begins with "mark" and "tag" members.
Example:
typedef struct { IoMark? mark; Tag *tag; ByteArray? *byteArray; } IoString?;
The mark is for garbage collection purposes and the tag is a reference the primitive's tag datastructure. The tag is used to figure out which C function to call for a given operation on a value. For example, when the garbage collector decides to free the IoString??, it ends up looking in the IoString??'s tag and finds the freeFunc function pointer and calls it. This function pointer is set to IoString?_free. The freeFunc function pointer in a tag for a different primitive would would be set to a different C function. This makes it easier for people to externally add new primitves.
Links:
- [2] See Lua 4.http://www.lua.org/manual/4.0/manual.html manual in sections 3 and 4, at http://www.lua.org/manual/4.0/manual.html. They provide a great
explaination on how tags can be used.
C. Reflectivity
Io is an intrinsically open language, as it offers very powerful reflexive features. One of the interesting features is that Io stores the whole program as a tree that mirrors the source code. This tree is not compiled to bytecode, but is rather directly executed.
One of the side effects of this choice is that you can get the source code at anytime. For instance, any Io object can output its source code. This is a truely interesting feature from an open-source development perspective, which recalls me the power of categories in Objective-C.
D. Language constructs reification
The combination of tags and reflexivity grants Io with very powerful self-modifications features, such as redefining the behaviour of executing a block value. Here is a Io code snippet that substitutes the default block activation function with a new one:
IoTag? *tag = IoState?_tagWithInitFunction_(ioState, StateTagInit?*)IoBlock?_initTagWithId_); tag->activationFunc = MyBlockActivationFunc?;
then in the activation function, you can do what you want:
IoValue? * MyBlockActivationFunc?(IoBlock? *self, IoObject? *target, IoObject? *locals, IoMessage? *m) { /* Do what I want */ /* And call the normal IoBlock? activation function */ IoBlock?_target_locals_call_(self, target, locals, m); }
[ Note that this example was given by Steve on the Io mailing-list]
I'm not sure if this is the right term for qualifying this, but to me, language reification means that the language internal mechanism is reified so as to be able to reprogram the language with the language itself (or through the use of simple extensions in C).
See http://www.wikipedia.org/wiki/Dynamic_typing
Comments
Feel free to add comments on this document.
Io language notes
Io is a small, well-designed and efficient scripting language created in 2002 by Steve Dekorte. Io is particularily pleasant because it has a rather clean, regular syntax that frees us from the ugly C-style braces and trailing semicolons, pretty much like an hybrid of Python and Lisp. Io also offers very high level language traits that condense much of the advances made in scripting years since the 90s.
Io notably introduces some interesting perspectives and features such as prototype-based inhertiance, asynchronous execution operator, or full reflectivity.
Io language main site is available at http://www.iolanguage.com, Steve's page is available at http://www.dekorte.com. There is also the main Io wiki available at http://io.kicks-ass.net/FrontPage.
Related pages:
- QuestionsAndAnswers, questions and answers that came on the Io mailing list
- {{Gotchas}}, a page that tries to collect common gotchas for Io newbies
- PrototypesVsClasses, compares the prototype-based inheritance to the class-based inheritance
- ObjcBridge, introduces the bridge that allows cross-integration of Io and Objective-C.
- ModuleSystem, a draft for a module/package system for Io
- DocumentationSystem, a draft for a documentation system for Io
- IoUnit, a simple automated testing framework for Io
1. A quick glance at Io
Here's is a basic "Hello World" written in Io:
write("Hello World\n")
And here is an Object-oriented "Hello World" written in Io:
HelloObject := Object clone
HelloObject sayHello := method(
"Hello World!" print
)
HelloObject sayHello()
You can check out some more Io examples here http://www.iolanguage.com/SampleCode.html.
2. Io language traits
Now that the impatient was fed with some source code, I will introduce Io from a more theoretical point of view and expose the traits (a.k.a. the language features) that make it such a pleasant beast:
- Prototype-based inheritance: Inheritance in IO is realised by cloning objects and maintaining a dynamic relation between the clone and the original.
- Message-oriented: all interactions in Io are made through messages, which are the equivalent of function and method calls in other languages. Messages are also reified into the languages, which allows to manipulate them as any other object.
- Purely Object-Oriented: all entities that are manipulated in Io derive from the same Object prototype.
- Garbage-collected: objects are automatically allocated and deallocated.
- Dynamically typed: although Io has a notion of type, variables are untyped and operations prototypes do not carry type information. Some type checks can be made using generally available methods.
- Interpreted: Io source code is not compiled to bytecode but rather read and converted to an in-memory representation.
- Code as data: blocks of code are reified into objects, which can be modified and dynamically created.
- Reflective: as a consequence of the "code as data", it is possible to investigate the properties of any Io object at runtime, including its source code.
- Dynamic: because code is data (and vice-versa), it is possible to change a program logic during its execution. It is of course also possible to dynamically modify an object attributes and operations at runtime. Combined with the prototype-based inheritance, this allows to dynamically "change an object class".
Although Io shares some traits with functional languages, Io could be considered as a member of the imperative family of languages. However, Io dynamicity and deep reflectivity enables programming styles that are not usually possible with other languages from the imperative family.
I consider Io as a very interesting language for scripting existing applications, while I would rather advice the use of a statically, strongly typed language for the application core. Io has a simple syntax, is very flexible and powerful, but lacks some features of more mature languages, such as Python:
- Io does not offer a module/package system
- There is no code documentation tool (e.g. JavaDoc?, POD, PyDoc?, etc)
- There are no type-checking/object utilities (interfaces)
Io is constently evoloving, and Steve is rather open to comments, as proved the improvement of the VM toward a single-rooted object hierarchy (primitives used to inherit from IoValue?, and Object was a primitive) undergone in June 2003. In this respect, this small disadvantages will be surely be resolved in the future. In the meantime, Io is really fun to play with, and is a perfect language to be embedded in an application (especially Objective-C apps ;).
3. Io terminology
To have a better understanding of the different terms encountered in Io documentation and in the Io mailing list, here is a short list of terms with their accompanying definition:
- Prototype: a prototype is an object that can be cloned. The link between a clone and its prototype is very close to the link between a class and an instance. Clones will resolve attributes and operations that are not locally defined in their prototype. If this sounds abstract, you can think of prototypes as classes that you could create and manipulate just as other objects.
- Slot: a slot is an object part that allows to bind values to names. Slots can be considered as a name --> value mapping belonging to a particular object. Attributes and operations are first resolved in an object slot. For Pythonistas, a slot is the equivalent of an entry in a hash table.
- Actor: First introduced by Carl Hewitt in his PLANNER paper of 1969, the concept of an actor is equivalent to an active object (thread) that would asynchronously process received messages (like operations). In Gul Agha actor model, messages are first queued in a FIFO attached to the object, and then sequentially processed. Actors are sometimes refered to as active objects, and even agents, though the use of this term is controversial.
- Asynchronous message: when an object (sender) sends a message to another object (receiver), the sender usually waits for the sender to receive the message, process it and send a response (indicating the message was processed, optionally with a return value). This is called synchronous communication, when sending is a blocking act for the sender. With asynchronous messages, the sender simply sends the message, but do not wait for the response, enable it to continue to act while the message is processed by the receiver.
- Future: also know as "promise" a Future is an encapsulation of the future response message (actually response value) to an asynchronous message. A future enables objects to reference a value that is not yet computed.
Note: Maybe also exlain continuation, scope, resolution, tag, typed and untyped, reflectivity, etc.
Recommendend readings:
- Reactive objects by Joan Nordlander
- http://lambda.weblogs.com Lambda the Ultimate
4. Io object model
Io is a purely object-oriented language, which means that everything is an object. Many object languages that derive from the C family are not able to manipulate primitive types (integers, floats, etc) consistently with object. Io has a single primitive: the Object. In this respect, the dynamic properties of objects are available for all entities in Io.
Definition of a message Prototype based Values, Primitives and Objects Mechanisms involved in responsing to a message Messaging model
Io has the very appreciable feature of accessing the object that sent a message to the receiving object. This allows to modify the behaviour of the receiving object according to the type of the invoking object. The sender object is accessible using the "sender" slot of the receiving object.
5. Understanding Io concepts
Io is based on some concepts that may not be familiar to people used to common programming languages such as C, C++ or Java. At first, Io is inspired by the following kinds of languages:
- Prototype-based language: languages that realise inheritance by cloning object rather than instanciating them from a class.
- Actor language: languages that consider objects to be dynamic and to communicate with messages
- Functional languages: languages that provide a lambda-like operator, either closure or blocks.
Don't be afraid if you don't know the languages or understand my short presentation, this will be explained here.
A. Types and Protoypes
Even if types and prototypes share the same "types" suffix, they both represent different things. A type qualifies and categories a given value, while a prototype is already a value.
Most programming languages allow to define new types ; in object-oriented programming, new types are defined with classes. Classes can be considered as a model that will be reproduced by the instances, the reproduction of the model is done by the class constructor operations. The main problem with classes is that they may not be referencable or accessible (if the language is not reflexive like C++, unlike Java), and that it is definitely not possible to modify them at runtime.
Prototypes allow to do the same as defining new types through classes: instead of describing a class, we construct an object that will serve as the actual model for future "instances". The equivalent operation to creating an instance is simply to "clone" the prototype. This language trait allow to freely manipulate prototype, which is not always possible with classes (though a fully reflexive non-prototype language would certainly exhibit the same features).
The idea behind prototypes (which could also be called "stereotype") is that you build a collection of predefined objects that will serve as a basis for all object that will be based on them. Prototype is a very interesting way to weave objets together.
A good thing would also be to have a look at this page http://www.wikipedia.org/wiki/Prototype_based.
B. Types and Tags
Tag in Io are inspired from Lua typing system [2], a tag specifies a given type. For instance, a Lua function could be either implemented in Lua or in C. To make the difference between both functions (which are considered as first-class language citizens, ie. values) the tag is used to indicate wether the function is in C or in Lua. Tags can then be considered as a sub-type.
Tags are useful for customising Io because they allow to extend or redefine the behaviour of a specific type, like for instance redefine how a list would react the add or remove messages.
Steve gives the following explaination on tags :
Every value is a primitive of some sort - a String, List, Objects, etc. And the data structure for each primitive begins with "mark" and "tag" members.
Example:
typedef struct { IoMark? mark; Tag *tag; ByteArray? *byteArray; } IoString?;
The mark is for garbage collection purposes and the tag is a reference the primitive's tag datastructure. The tag is used to figure out which C function to call for a given operation on a value. For example, when the garbage collector decides to free the IoString??, it ends up looking in the IoString??'s tag and finds the freeFunc function pointer and calls it. This function pointer is set to IoString?_free. The freeFunc function pointer in a tag for a different primitive would would be set to a different C function. This makes it easier for people to externally add new primitves.
Links:
- [2] See Lua 4.http://www.lua.org/manual/4.0/manual.html manual in sections 3 and 4, at http://www.lua.org/manual/4.0/manual.html. They provide a great
explaination on how tags can be used.
C. Reflectivity
Io is an intrinsically open language, as it offers very powerful reflexive features. One of the interesting features is that Io stores the whole program as a tree that mirrors the source code. This tree is not compiled to bytecode, but is rather directly executed.
One of the side effects of this choice is that you can get the source code at anytime. For instance, any Io object can output its source code. This is a truely interesting feature from an open-source development perspective, which recalls me the power of categories in Objective-C.
D. Language constructs reification
The combination of tags and reflexivity grants Io with very powerful self-modifications features, such as redefining the behaviour of executing a block value. Here is a Io code snippet that substitutes the default block activation function with a new one:
IoTag? *tag = IoState?_tagWithInitFunction_(ioState, StateTagInit?*)IoBlock?_initTagWithId_); tag->activationFunc = MyBlockActivationFunc?;
then in the activation function, you can do what you want:
IoValue? * MyBlockActivationFunc?(IoBlock? *self, IoObject? *target, IoObject? *locals, IoMessage? *m) { /* Do what I want */ /* And call the normal IoBlock? activation function */ IoBlock?_target_locals_call_(self, target, locals, m); }
[ Note that this example was given by Steve on the Io mailing-list]
I'm not sure if this is the right term for qualifying this, but to me, language reification means that the language internal mechanism is reified so as to be able to reprogram the language with the language itself (or through the use of simple extensions in C).
See http://www.wikipedia.org/wiki/Dynamic_typing
Comments
Feel free to add comments on this document.
online casino
online casino
Io language notes
Io is a small, well-designed and efficient scripting language created in 2002 by Steve Dekorte. Io is particularily pleasant because it has a rather clean, regular syntax that frees us from the ugly C-style braces and trailing semicolons, pretty much like an hybrid of Python and Lisp. Io also offers very high level language traits that condense much of the advances made in scripting years since the 90s.
Io notably introduces some interesting perspectives and features such as prototype-based inhertiance, asynchronous execution operator, or full reflectivity.
Io language main site is available at http://www.iolanguage.com, Steve's page is available at http://www.dekorte.com. There is also the main Io wiki available at http://io.kicks-ass.net/FrontPage.
Related pages:
- QuestionsAndAnswers, questions and answers that came on the Io mailing list
- {{Gotchas}}, a page that tries to collect common gotchas for Io newbies
- PrototypesVsClasses, compares the prototype-based inheritance to the class-based inheritance
- ObjcBridge, introduces the bridge that allows cross-integration of Io and Objective-C.
- ModuleSystem, a draft for a module/package system for Io
- DocumentationSystem, a draft for a documentation system for Io
- IoUnit, a simple automated testing framework for Io
1. A quick glance at Io
Here's is a basic "Hello World" written in Io:
write("Hello World\n")
And here is an Object-oriented "Hello World" written in Io:
HelloObject := Object clone
HelloObject sayHello := method(
"Hello World!" print
)
HelloObject sayHello()
You can check out some more Io examples here http://www.iolanguage.com/SampleCode.html.
2. Io language traits
Now that the impatient was fed with some source code, I will introduce Io from a more theoretical point of view and expose the traits (a.k.a. the language features) that make it such a pleasant beast:
- Prototype-based inheritance: Inheritance in IO is realised by cloning objects and maintaining a dynamic relation between the clone and the original.
- Message-oriented: all interactions in Io are made through messages, which are the equivalent of function and method calls in other languages. Messages are also reified into the languages, which allows to manipulate them as any other object.
- Purely Object-Oriented: all entities that are manipulated in Io derive from the same Object prototype.
- Garbage-collected: objects are automatically allocated and deallocated.
- Dynamically typed: although Io has a notion of type, variables are untyped and operations prototypes do not carry type information. Some type checks can be made using generally available methods.
- Interpreted: Io source code is not compiled to bytecode but rather read and converted to an in-memory representation.
- Code as data: blocks of code are reified into objects, which can be modified and dynamically created.
- Reflective: as a consequence of the "code as data", it is possible to investigate the properties of any Io object at runtime, including its source code.
- Dynamic: because code is data (and vice-versa), it is possible to change a program logic during its execution. It is of course also possible to dynamically modify an object attributes and operations at runtime. Combined with the prototype-based inheritance, this allows to dynamically "change an object class".
Although Io shares some traits with functional languages, Io could be considered as a member of the imperative family of languages. However, Io dynamicity and deep reflectivity enables programming styles that are not usually possible with other languages from the imperative family.
I consider Io as a very interesting language for scripting existing applications, while I would rather advice the use of a statically, strongly typed language for the application core. Io has a simple syntax, is very flexible and powerful, but lacks some features of more mature languages, such as Python:
- Io does not offer a module/package system
- There is no code documentation tool (e.g. JavaDoc?, POD, PyDoc?, etc)
- There are no type-checking/object utilities (interfaces)
Io is constently evoloving, and Steve is rather open to comments, as proved the improvement of the VM toward a single-rooted object hierarchy (primitives used to inherit from IoValue?, and Object was a primitive) undergone in June 2003. In this respect, this small disadvantages will be surely be resolved in the future. In the meantime, Io is really fun to play with, and is a perfect language to be embedded in an application (especially Objective-C apps ;).
3. Io terminology
To have a better understanding of the different terms encountered in Io documentation and in the Io mailing list, here is a short list of terms with their accompanying definition:
- Prototype: a prototype is an object that can be cloned. The link between a clone and its prototype is very close to the link between a class and an instance. Clones will resolve attributes and operations that are not locally defined in their prototype. If this sounds abstract, you can think of prototypes as classes that you could create and manipulate just as other objects.
- Slot: a slot is an object part that allows to bind values to names. Slots can be considered as a name --> value mapping belonging to a particular object. Attributes and operations are first resolved in an object slot. For Pythonistas, a slot is the equivalent of an entry in a hash table.
- Actor: First introduced by Carl Hewitt in his PLANNER paper of 1969, the concept of an actor is equivalent to an active object (thread) that would asynchronously process received messages (like operations). In Gul Agha actor model, messages are first queued in a FIFO attached to the object, and then sequentially processed. Actors are sometimes refered to as active objects, and even agents, though the use of this term is controversial.
- Asynchronous message: when an object (sender) sends a message to another object (receiver), the sender usually waits for the sender to receive the message, process it and send a response (indicating the message was processed, optionally with a return value). This is called synchronous communication, when sending is a blocking act for the sender. With asynchronous messages, the sender simply sends the message, but do not wait for the response, enable it to continue to act while the message is processed by the receiver.
- Future: also know as "promise" a Future is an encapsulation of the future response message (actually response value) to an asynchronous message. A future enables objects to reference a value that is not yet computed.
Note: Maybe also exlain continuation, scope, resolution, tag, typed and untyped, reflectivity, etc.
Recommendend readings:
- Reactive objects by Joan Nordlander
- http://lambda.weblogs.com Lambda the Ultimate
4. Io object model
Io is a purely object-oriented language, which means that everything is an object. Many object languages that derive from the C family are not able to manipulate primitive types (integers, floats, etc) consistently with object. Io has a single primitive: the Object. In this respect, the dynamic properties of objects are available for all entities in Io.
Definition of a message Prototype based Values, Primitives and Objects Mechanisms involved in responsing to a message Messaging model
Io has the very appreciable feature of accessing the object that sent a message to the receiving object. This allows to modify the behaviour of the receiving object according to the type of the invoking object. The sender object is accessible using the "sender" slot of the receiving object.
5. Understanding Io concepts
Io is based on some concepts that may not be familiar to people used to common programming languages such as C, C++ or Java. At first, Io is inspired by the following kinds of languages:
- Prototype-based language: languages that realise inheritance by cloning object rather than instanciating them from a class.
- Actor language: languages that consider objects to be dynamic and to communicate with messages
- Functional languages: languages that provide a lambda-like operator, either closure or blocks.
Don't be afraid if you don't know the languages or understand my short presentation, this will be explained here.
A. Types and Protoypes
Even if types and prototypes share the same "types" suffix, they both represent different things. A type qualifies and categories a given value, while a prototype is already a value.
Most programming languages allow to define new types ; in object-oriented programming, new types are defined with classes. Classes can be considered as a model that will be reproduced by the instances, the reproduction of the model is done by the class constructor operations. The main problem with classes is that they may not be referencable or accessible (if the language is not reflexive like C++, unlike Java), and that it is definitely not possible to modify them at runtime.
Prototypes allow to do the same as defining new types through classes: instead of describing a class, we construct an object that will serve as the actual model for future "instances". The equivalent operation to creating an instance is simply to "clone" the prototype. This language trait allow to freely manipulate prototype, which is not always possible with classes (though a fully reflexive non-prototype language would certainly exhibit the same features).
The idea behind prototypes (which could also be called "stereotype") is that you build a collection of predefined objects that will serve as a basis for all object that will be based on them. Prototype is a very interesting way to weave objets together.
A good thing would also be to have a look at this page http://www.wikipedia.org/wiki/Prototype_based.
B. Types and Tags
Tag in Io are inspired from Lua typing system [2], a tag specifies a given type. For instance, a Lua function could be either implemented in Lua or in C. To make the difference between both functions (which are considered as first-class language citizens, ie. values) the tag is used to indicate wether the function is in C or in Lua. Tags can then be considered as a sub-type.
Tags are useful for customising Io because they allow to extend or redefine the behaviour of a specific type, like for instance redefine how a list would react the add or remove messages.
Steve gives the following explaination on tags :
Every value is a primitive of some sort - a String, List, Objects, etc. And the data structure for each primitive begins with "mark" and "tag" members.
Example:
typedef struct { IoMark? mark; Tag *tag; ByteArray? *byteArray; } IoString?;
The mark is for garbage collection purposes and the tag is a reference the primitive's tag datastructure. The tag is used to figure out which C function to call for a given operation on a value. For example, when the garbage collector decides to free the IoString??, it ends up looking in the IoString??'s tag and finds the freeFunc function pointer and calls it. This function pointer is set to IoString?_free. The freeFunc function pointer in a tag for a different primitive would would be set to a different C function. This makes it easier for people to externally add new primitves.
Links:
- [2] See Lua 4.http://www.lua.org/manual/4.0/manual.html manual in sections 3 and 4, at http://www.lua.org/manual/4.0/manual.html. They provide a great
explaination on how tags can be used.
C. Reflectivity
Io is an intrinsically open language, as it offers very powerful reflexive features. One of the interesting features is that Io stores the whole program as a tree that mirrors the source code. This tree is not compiled to bytecode, but is rather directly executed.
One of the side effects of this choice is that you can get the source code at anytime. For instance, any Io object can output its source code. This is a truely interesting feature from an open-source development perspective, which recalls me the power of categories in Objective-C.
D. Language constructs reification
The combination of tags and reflexivity grants Io with very powerful self-modifications features, such as redefining the behaviour of executing a block value. Here is a Io code snippet that substitutes the default block activation function with a new one:
IoTag? *tag = IoState?_tagWithInitFunction_(ioState, StateTagInit?*)IoBlock?_initTagWithId_); tag->activationFunc = MyBlockActivationFunc?;
then in the activation function, you can do what you want:
IoValue? * MyBlockActivationFunc?(IoBlock? *self, IoObject? *target, IoObject? *locals, IoMessage? *m) { /* Do what I want */ /* And call the normal IoBlock? activation function */ IoBlock?_target_locals_call_(self, target, locals, m); }
[ Note that this example was given by Steve on the Io mailing-list]
I'm not sure if this is the right term for qualifying this, but to me, language reification means that the language internal mechanism is reified so as to be able to reprogram the language with the language itself (or through the use of simple extensions in C).
See http://www.wikipedia.org/wiki/Dynamic_typing
Comments
Feel free to add comments on this document.
Io language notes
Io is a small, well-designed and efficient scripting language created in 2002 by Steve Dekorte. Io is particularily pleasant because it has a rather clean, regular syntax that frees us from the ugly C-style braces and trailing semicolons, pretty much like an hybrid of Python and Lisp. Io also offers very high level language traits that condense much of the advances made in scripting years since the 90s.
Io notably introduces some interesting perspectives and features such as prototype-based inhertiance, asynchronous execution operator, or full reflectivity.
Io language main site is available at http://www.iolanguage.com, Steve's page is available at http://www.dekorte.com. There is also the main Io wiki available at http://io.kicks-ass.net/FrontPage.
Related pages:
- QuestionsAndAnswers, questions and answers that came on the Io mailing list
- {{Gotchas}}, a page that tries to collect common gotchas for Io newbies
- PrototypesVsClasses, compares the prototype-based inheritance to the class-based inheritance
- ObjcBridge, introduces the bridge that allows cross-integration of Io and Objective-C.
- ModuleSystem, a draft for a module/package system for Io
- DocumentationSystem, a draft for a documentation system for Io
- IoUnit, a simple automated testing framework for Io
1. A quick glance at Io
Here's is a basic "Hello World" written in Io:
write("Hello World\n")
And here is an Object-oriented "Hello World" written in Io:
HelloObject := Object clone
HelloObject sayHello := method(
"Hello World!" print
)
HelloObject sayHello()
You can check out some more Io examples here http://www.iolanguage.com/SampleCode.html.
2. Io language traits
Now that the impatient was fed with some source code, I will introduce Io from a more theoretical point of view and expose the traits (a.k.a. the language features) that make it such a pleasant beast:
- Prototype-based inheritance: Inheritance in IO is realised by cloning objects and maintaining a dynamic relation between the clone and the original.
- Message-oriented: all interactions in Io are made through messages, which are the equivalent of function and method calls in other languages. Messages are also reified into the languages, which allows to manipulate them as any other object.
- Purely Object-Oriented: all entities that are manipulated in Io derive from the same Object prototype.
- Garbage-collected: objects are automatically allocated and deallocated.
- Dynamically typed: although Io has a notion of type, variables are untyped and operations prototypes do not carry type information. Some type checks can be made using generally available methods.
- Interpreted: Io source code is not compiled to bytecode but rather read and converted to an in-memory representation.
- Code as data: blocks of code are reified into objects, which can be modified and dynamically created.
- Reflective: as a consequence of the "code as data", it is possible to investigate the properties of any Io object at runtime, including its source code.
- Dynamic: because code is data (and vice-versa), it is possible to change a program logic during its execution. It is of course also possible to dynamically modify an object attributes and operations at runtime. Combined with the prototype-based inheritance, this allows to dynamically "change an object class".
Although Io shares some traits with functional languages, Io could be considered as a member of the imperative family of languages. However, Io dynamicity and deep reflectivity enables programming styles that are not usually possible with other languages from the imperative family.
I consider Io as a very interesting language for scripting existing applications, while I would rather advice the use of a statically, strongly typed language for the application core. Io has a simple syntax, is very flexible and powerful, but lacks some features of more mature languages, such as Python:
- Io does not offer a module/package system
- There is no code documentation tool (e.g. JavaDoc?, POD, PyDoc?, etc)
- There are no type-checking/object utilities (interfaces)
Io is constently evoloving, and Steve is rather open to comments, as proved the improvement of the VM toward a single-rooted object hierarchy (primitives used to inherit from IoValue?, and Object was a primitive) undergone in June 2003. In this respect, this small disadvantages will be surely be resolved in the future. In the meantime, Io is really fun to play with, and is a perfect language to be embedded in an application (especially Objective-C apps ;).
3. Io terminology
To have a better understanding of the different terms encountered in Io documentation and in the Io mailing list, here is a short list of terms with their accompanying definition:
- Prototype: a prototype is an object that can be cloned. The link between a clone and its prototype is very close to the link between a class and an instance. Clones will resolve attributes and operations that are not locally defined in their prototype. If this sounds abstract, you can think of prototypes as classes that you could create and manipulate just as other objects.
- Slot: a slot is an object part that allows to bind values to names. Slots can be considered as a name --> value mapping belonging to a particular object. Attributes and operations are first resolved in an object slot. For Pythonistas, a slot is the equivalent of an entry in a hash table.
- Actor: First introduced by Carl Hewitt in his PLANNER paper of 1969, the concept of an actor is equivalent to an active object (thread) that would asynchronously process received messages (like operations). In Gul Agha actor model, messages are first queued in a FIFO attached to the object, and then sequentially processed. Actors are sometimes refered to as active objects, and even agents, though the use of this term is controversial.
- Asynchronous message: when an object (sender) sends a message to another object (receiver), the sender usually waits for the sender to receive the message, process it and send a response (indicating the message was processed, optionally with a return value). This is called synchronous communication, when sending is a blocking act for the sender. With asynchronous messages, the sender simply sends the message, but do not wait for the response, enable it to continue to act while the message is processed by the receiver.
- Future: also know as "promise" a Future is an encapsulation of the future response message (actually response value) to an asynchronous message. A future enables objects to reference a value that is not yet computed.
Note: Maybe also exlain continuation, scope, resolution, tag, typed and untyped, reflectivity, etc.
Recommendend readings:
- Reactive objects by Joan Nordlander
- http://lambda.weblogs.com Lambda the Ultimate
4. Io object model
Io is a purely object-oriented language, which means that everything is an object. Many object languages that derive from the C family are not able to manipulate primitive types (integers, floats, etc) consistently with object. Io has a single primitive: the Object. In this respect, the dynamic properties of objects are available for all entities in Io.
Definition of a message Prototype based Values, Primitives and Objects Mechanisms involved in responsing to a message Messaging model
Io has the very appreciable feature of accessing the object that sent a message to the receiving object. This allows to modify the behaviour of the receiving object according to the type of the invoking object. The sender object is accessible using the "sender" slot of the receiving object.
5. Understanding Io concepts
Io is based on some concepts that may not be familiar to people used to common programming languages such as C, C++ or Java. At first, Io is inspired by the following kinds of languages:
- Prototype-based language: languages that realise inheritance by cloning object rather than instanciating them from a class.
- Actor language: languages that consider objects to be dynamic and to communicate with messages
- Functional languages: languages that provide a lambda-like operator, either closure or blocks.
Don't be afraid if you don't know the languages or understand my short presentation, this will be explained here.
A. Types and Protoypes
Even if types and prototypes share the same "types" suffix, they both represent different things. A type qualifies and categories a given value, while a prototype is already a value.
Most programming languages allow to define new types ; in object-oriented programming, new types are defined with classes. Classes can be considered as a model that will be reproduced by the instances, the reproduction of the model is done by the class constructor operations. The main problem with classes is that they may not be referencable or accessible (if the language is not reflexive like C++, unlike Java), and that it is definitely not possible to modify them at runtime.
Prototypes allow to do the same as defining new types through classes: instead of describing a class, we construct an object that will serve as the actual model for future "instances". The equivalent operation to creating an instance is simply to "clone" the prototype. This language trait allow to freely manipulate prototype, which is not always possible with classes (though a fully reflexive non-prototype language would certainly exhibit the same features).
The idea behind prototypes (which could also be called "stereotype") is that you build a collection of predefined objects that will serve as a basis for all object that will be based on them. Prototype is a very interesting way to weave objets together.
A good thing would also be to have a look at this page http://www.wikipedia.org/wiki/Prototype_based.
B. Types and Tags
Tag in Io are inspired from Lua typing system [2], a tag specifies a given type. For instance, a Lua function could be either implemented in Lua or in C. To make the difference between both functions (which are considered as first-class language citizens, ie. values) the tag is used to indicate wether the function is in C or in Lua. Tags can then be considered as a sub-type.
Tags are useful for customising Io because they allow to extend or redefine the behaviour of a specific type, like for instance redefine how a list would react the add or remove messages.
Steve gives the following explaination on tags :
Every value is a primitive of some sort - a String, List, Objects, etc. And the data structure for each primitive begins with "mark" and "tag" members.
Example:
typedef struct { IoMark? mark; Tag *tag; ByteArray? *byteArray; } IoString?;
The mark is for garbage collection purposes and the tag is a reference the primitive's tag datastructure. The tag is used to figure out which C function to call for a given operation on a value. For example, when the garbage collector decides to free the IoString??, it ends up looking in the IoString??'s tag and finds the freeFunc function pointer and calls it. This function pointer is set to IoString?_free. The freeFunc function pointer in a tag for a different primitive would would be set to a different C function. This makes it easier for people to externally add new primitves.
Links:
- [2] See Lua 4.http://www.lua.org/manual/4.0/manual.html manual in sections 3 and 4, at http://www.lua.org/manual/4.0/manual.html. They provide a great
explaination on how tags can be used.
C. Reflectivity
Io is an intrinsically open language, as it offers very powerful reflexive features. One of the interesting features is that Io stores the whole program as a tree that mirrors the source code. This tree is not compiled to bytecode, but is rather directly executed.
One of the side effects of this choice is that you can get the source code at anytime. For instance, any Io object can output its source code. This is a truely interesting feature from an open-source development perspective, which recalls me the power of categories in Objective-C.
D. Language constructs reification
The combination of tags and reflexivity grants Io with very powerful self-modifications features, such as redefining the behaviour of executing a block value. Here is a Io code snippet that substitutes the default block activation function with a new one:
IoTag? *tag = IoState?_tagWithInitFunction_(ioState, StateTagInit?*)IoBlock?_initTagWithId_); tag->activationFunc = MyBlockActivationFunc?;
then in the activation function, you can do what you want:
IoValue? * MyBlockActivationFunc?(IoBlock? *self, IoObject? *target, IoObject? *locals, IoMessage? *m) { /* Do what I want */ /* And call the normal IoBlock? activation function */ IoBlock?_target_locals_call_(self, target, locals, m); }
[ Note that this example was given by Steve on the Io mailing-list]
I'm not sure if this is the right term for qualifying this, but to me, language reification means that the language internal mechanism is reified so as to be able to reprogram the language with the language itself (or through the use of simple extensions in C).
See http://www.wikipedia.org/wiki/Dynamic_typing
Comments
Feel free to add comments on this document.
online casino
Io language notes
Io is a small, well-designed and efficient scripting language created in 2002 by Steve Dekorte. Io is particularily pleasant because it has a rather clean, regular syntax that frees us from the ugly C-style braces and trailing semicolons, pretty much like an hybrid of Python and Lisp. Io also offers very high level language traits that condense much of the advances made in scripting years since the 90s.
Io notably introduces some interesting perspectives and features such as prototype-based inhertiance, asynchronous execution operator, or full reflectivity.
Io language main site is available at http://www.iolanguage.com, Steve's page is available at http://www.dekorte.com. There is also the main Io wiki available at http://io.kicks-ass.net/FrontPage.
Related pages:
- QuestionsAndAnswers, questions and answers that came on the Io mailing list
- {{Gotchas}}, a page that tries to collect common gotchas for Io newbies
- PrototypesVsClasses, compares the prototype-based inheritance to the class-based inheritance
- ObjcBridge, introduces the bridge that allows cross-integration of Io and Objective-C.
- ModuleSystem, a draft for a module/package system for Io
- DocumentationSystem, a draft for a documentation system for Io
- IoUnit, a simple automated testing framework for Io
1. A quick glance at Io
Here's is a basic "Hello World" written in Io:
write("Hello World\n")
And here is an Object-oriented "Hello World" written in Io:
HelloObject := Object clone
HelloObject sayHello := method(
"Hello World!" print
)
HelloObject sayHello()
You can check out some more Io examples here http://www.iolanguage.com/SampleCode.html.
2. Io language traits
Now that the impatient was fed with some source code, I will introduce Io from a more theoretical point of view and expose the traits (a.k.a. the language features) that make it such a pleasant beast:
- Prototype-based inheritance: Inheritance in IO is realised by cloning objects and maintaining a dynamic relation between the clone and the original.
- Message-oriented: all interactions in Io are made through messages, which are the equivalent of function and method calls in other languages. Messages are also reified into the languages, which allows to manipulate them as any other object.
- Purely Object-Oriented: all entities that are manipulated in Io derive from the same Object prototype.
- Garbage-collected: objects are automatically allocated and deallocated.
- Dynamically typed: although Io has a notion of type, variables are untyped and operations prototypes do not carry type information. Some type checks can be made using generally available methods.
- Interpreted: Io source code is not compiled to bytecode but rather read and converted to an in-memory representation.
- Code as data: blocks of code are reified into objects, which can be modified and dynamically created.
- Reflective: as a consequence of the "code as data", it is possible to investigate the properties of any Io object at runtime, including its source code.
- Dynamic: because code is data (and vice-versa), it is possible to change a program logic during its execution. It is of course also possible to dynamically modify an object attributes and operations at runtime. Combined with the prototype-based inheritance, this allows to dynamically "change an object class".
Although Io shares some traits with functional languages, Io could be considered as a member of the imperative family of languages. However, Io dynamicity and deep reflectivity enables programming styles that are not usually possible with other languages from the imperative family.
I consider Io as a very interesting language for scripting existing applications, while I would rather advice the use of a statically, strongly typed language for the application core. Io has a simple syntax, is very flexible and powerful, but lacks some features of more mature languages, such as Python:
- Io does not offer a module/package system
- There is no code documentation tool (e.g. JavaDoc?, POD, PyDoc?, etc)
- There are no type-checking/object utilities (interfaces)
Io is constently evoloving, and Steve is rather open to comments, as proved the improvement of the VM toward a single-rooted object hierarchy (primitives used to inherit from IoValue?, and Object was a primitive) undergone in June 2003. In this respect, this small disadvantages will be surely be resolved in the future. In the meantime, Io is really fun to play with, and is a perfect language to be embedded in an application (especially Objective-C apps ;).
3. Io terminology
To have a better understanding of the different terms encountered in Io documentation and in the Io mailing list, here is a short list of terms with their accompanying definition:
- Prototype: a prototype is an object that can be cloned. The link between a clone and its prototype is very close to the link between a class and an instance. Clones will resolve attributes and operations that are not locally defined in their prototype. If this sounds abstract, you can think of prototypes as classes that you could create and manipulate just as other objects.
- Slot: a slot is an object part that allows to bind values to names. Slots can be considered as a name --> value mapping belonging to a particular object. Attributes and operations are first resolved in an object slot. For Pythonistas, a slot is the equivalent of an entry in a hash table.
- Actor: First introduced by Carl Hewitt in his PLANNER paper of 1969, the concept of an actor is equivalent to an active object (thread) that would asynchronously process received messages (like operations). In Gul Agha actor model, messages are first queued in a FIFO attached to the object, and then sequentially processed. Actors are sometimes refered to as active objects, and even agents, though the use of this term is controversial.
- Asynchronous message: when an object (sender) sends a message to another object (receiver), the sender usually waits for the sender to receive the message, process it and send a response (indicating the message was processed, optionally with a return value). This is called synchronous communication, when sending is a blocking act for the sender. With asynchronous messages, the sender simply sends the message, but do not wait for the response, enable it to continue to act while the message is processed by the receiver.
- Future: also know as "promise" a Future is an encapsulation of the future response message (actually response value) to an asynchronous message. A future enables objects to reference a value that is not yet computed.
Note: Maybe also exlain continuation, scope, resolution, tag, typed and untyped, reflectivity, etc.
Recommendend readings:
- Reactive objects by Joan Nordlander
- http://lambda.weblogs.com Lambda the Ultimate
4. Io object model
Io is a purely object-oriented language, which means that everything is an object. Many object languages that derive from the C family are not able to manipulate primitive types (integers, floats, etc) consistently with object. Io has a single primitive: the Object. In this respect, the dynamic properties of objects are available for all entities in Io.
Definition of a message Prototype based Values, Primitives and Objects Mechanisms involved in responsing to a message Messaging model
Io has the very appreciable feature of accessing the object that sent a message to the receiving object. This allows to modify the behaviour of the receiving object according to the type of the invoking object. The sender object is accessible using the "sender" slot of the receiving object.
5. Understanding Io concepts
Io is based on some concepts that may not be familiar to people used to common programming languages such as C, C++ or Java. At first, Io is inspired by the following kinds of languages:
- Prototype-based language: languages that realise inheritance by cloning object rather than instanciating them from a class.
- Actor language: languages that consider objects to be dynamic and to communicate with messages
- Functional languages: languages that provide a lambda-like operator, either closure or blocks.
Don't be afraid if you don't know the languages or understand my short presentation, this will be explained here.
A. Types and Protoypes
Even if types and prototypes share the same "types" suffix, they both represent different things. A type qualifies and categories a given value, while a prototype is already a value.
Most programming languages allow to define new types ; in object-oriented programming, new types are defined with classes. Classes can be considered as a model that will be reproduced by the instances, the reproduction of the model is done by the class constructor operations. The main problem with classes is that they may not be referencable or accessible (if the language is not reflexive like C++, unlike Java), and that it is definitely not possible to modify them at runtime.
Prototypes allow to do the same as defining new types through classes: instead of describing a class, we construct an object that will serve as the actual model for future "instances". The equivalent operation to creating an instance is simply to "clone" the prototype. This language trait allow to freely manipulate prototype, which is not always possible with classes (though a fully reflexive non-prototype language would certainly exhibit the same features).
The idea behind prototypes (which could also be called "stereotype") is that you build a collection of predefined objects that will serve as a basis for all object that will be based on them. Prototype is a very interesting way to weave objets together.
A good thing would also be to have a look at this page http://www.wikipedia.org/wiki/Prototype_based.
B. Types and Tags
Tag in Io are inspired from Lua typing system [2], a tag specifies a given type. For instance, a Lua function could be either implemented in Lua or in C. To make the difference between both functions (which are considered as first-class language citizens, ie. values) the tag is used to indicate wether the function is in C or in Lua. Tags can then be considered as a sub-type.
Tags are useful for customising Io because they allow to extend or redefine the behaviour of a specific type, like for instance redefine how a list would react the add or remove messages.
Steve gives the following explaination on tags :
Every value is a primitive of some sort - a String, List, Objects, etc. And the data structure for each primitive begins with "mark" and "tag" members.
Example:
typedef struct { IoMark? mark; Tag *tag; ByteArray? *byteArray; } IoString?;
The mark is for garbage collection purposes and the tag is a reference the primitive's tag datastructure. The tag is used to figure out which C function to call for a given operation on a value. For example, when the garbage collector decides to free the IoString??, it ends up looking in the IoString??'s tag and finds the freeFunc function pointer and calls it. This function pointer is set to IoString?_free. The freeFunc function pointer in a tag for a different primitive would would be set to a different C function. This makes it easier for people to externally add new primitves.
Links:
- [2] See Lua 4.http://www.lua.org/manual/4.0/manual.html manual in sections 3 and 4, at http://www.lua.org/manual/4.0/manual.html. They provide a great
explaination on how tags can be used.
C. Reflectivity
Io is an intrinsically open language, as it offers very powerful reflexive features. One of the interesting features is that Io stores the whole program as a tree that mirrors the source code. This tree is not compiled to bytecode, but is rather directly executed.
One of the side effects of this choice is that you can get the source code at anytime. For instance, any Io object can output its source code. This is a truely interesting feature from an open-source development perspective, which recalls me the power of categories in Objective-C.
D. Language constructs reification
The combination of tags and reflexivity grants Io with very powerful self-modifications features, such as redefining the behaviour of executing a block value. Here is a Io code snippet that substitutes the default block activation function with a new one:
IoTag? *tag = IoState?_tagWithInitFunction_(ioState, StateTagInit?*)IoBlock?_initTagWithId_); tag->activationFunc = MyBlockActivationFunc?;
then in the activation function, you can do what you want:
IoValue? * MyBlockActivationFunc?(IoBlock? *self, IoObject? *target, IoObject? *locals, IoMessage? *m) { /* Do what I want */ /* And call the normal IoBlock? activation function */ IoBlock?_target_locals_call_(self, target, locals, m); }
[ Note that this example was given by Steve on the Io mailing-list]
I'm not sure if this is the right term for qualifying this, but to me, language reification means that the language internal mechanism is reified so as to be able to reprogram the language with the language itself (or through the use of simple extensions in C).
See http://www.wikipedia.org/wiki/Dynamic_typing
Comments
Feel free to add comments on this document.
[http://www.casino-online-on-line.com] * [Online Casino | http://www.casino-online-on-line.com] * [Casino Online | http://www.casino-online-on-line.com] * [http://www.casino-online-on-line.com online casino] - games, internet casino, casino online casino, poker * [http://www.casino-online-on-line.com casino online] - games, internet casino, casino online casino, poker i want to play with sandbox... <a href="http://www.casino-online-on-line.com">online casino</a> it"s a very nice keyboard <a href="http://www.casino-online-on-line.com">casino online</a> the casino roulette as well <a href="http://www.casino-online-on-line.com">Internet Casino</a> sopranos is pretty exciting <a href="http://www.casino-online-on-line.com">Casino</a> money <a href="http://www.casino-online-on-line.com">online Poker</a> jesus christ <a href="http://www.casino-online-on-line.com">casino-online</a> with gir <a href="http://www.casino-online-on-line.com">online-casino</a> i would google family <a href="http://www.google.com">Google</a> about my alone gambling
Io language notes
Io is a small, well-designed and efficient scripting language created in 2002 by Steve Dekorte. Io is particularily pleasant because it has a rather clean, regular syntax that frees us from the ugly C-style braces and trailing semicolons, pretty much like an hybrid of Python and Lisp. Io also offers very high level language traits that condense much of the advances made in scripting years since the 90s.
Io notably introduces some interesting perspectives and features such as prototype-based inhertiance, asynchronous execution operator, or full reflectivity.
Io language main site is available at http://www.iolanguage.com, Steve's page is available at http://www.dekorte.com. There is also the main Io wiki available at http://io.kicks-ass.net/FrontPage.
Related pages:
- QuestionsAndAnswers, questions and answers that came on the Io mailing list
- {{Gotchas}}, a page that tries to collect common gotchas for Io newbies
- PrototypesVsClasses, compares the prototype-based inheritance to the class-based inheritance
- ObjcBridge, introduces the bridge that allows cross-integration of Io and Objective-C.
- ModuleSystem, a draft for a module/package system for Io
- DocumentationSystem, a draft for a documentation system for Io
- IoUnit, a simple automated testing framework for Io
1. A quick glance at Io
Here's is a basic "Hello World" written in Io:
write("Hello World\n")
And here is an Object-oriented "Hello World" written in Io:
HelloObject := Object clone
HelloObject sayHello := method(
"Hello World!" print
)
HelloObject sayHello()
You can check out some more Io examples here http://www.iolanguage.com/SampleCode.html.
2. Io language traits
Now that the impatient was fed with some source code, I will introduce Io from a more theoretical point of view and expose the traits (a.k.a. the language features) that make it such a pleasant beast:
- Prototype-based inheritance: Inheritance in IO is realised by cloning objects and maintaining a dynamic relation between the clone and the original.
- Message-oriented: all interactions in Io are made through messages, which are the equivalent of function and method calls in other languages. Messages are also reified into the languages, which allows to manipulate them as any other object.
- Purely Object-Oriented: all entities that are manipulated in Io derive from the same Object prototype.
- Garbage-collected: objects are automatically allocated and deallocated.
- Dynamically typed: although Io has a notion of type, variables are untyped and operations prototypes do not carry type information. Some type checks can be made using generally available methods.
- Interpreted: Io source code is not compiled to bytecode but rather read and converted to an in-memory representation.
- Code as data: blocks of code are reified into objects, which can be modified and dynamically created.
- Reflective: as a consequence of the "code as data", it is possible to investigate the properties of any Io object at runtime, including its source code.
- Dynamic: because code is data (and vice-versa), it is possible to change a program logic during its execution. It is of course also possible to dynamically modify an object attributes and operations at runtime. Combined with the prototype-based inheritance, this allows to dynamically "change an object class".
Although Io shares some traits with functional languages, Io could be considered as a member of the imperative family of languages. However, Io dynamicity and deep reflectivity enables programming styles that are not usually possible with other languages from the imperative family.
I consider Io as a very interesting language for scripting existing applications, while I would rather advice the use of a statically, strongly typed language for the application core. Io has a simple syntax, is very flexible and powerful, but lacks some features of more mature languages, such as Python:
- Io does not offer a module/package system
- There is no code documentation tool (e.g. JavaDoc?, POD, PyDoc?, etc)
- There are no type-checking/object utilities (interfaces)
Io is constently evoloving, and Steve is rather open to comments, as proved the improvement of the VM toward a single-rooted object hierarchy (primitives used to inherit from IoValue?, and Object was a primitive) undergone in June 2003. In this respect, this small disadvantages will be surely be resolved in the future. In the meantime, Io is really fun to play with, and is a perfect language to be embedded in an application (especially Objective-C apps ;).
3. Io terminology
To have a better understanding of the different terms encountered in Io documentation and in the Io mailing list, here is a short list of terms with their accompanying definition:
- Prototype: a prototype is an object that can be cloned. The link between a clone and its prototype is very close to the link between a class and an instance. Clones will resolve attributes and operations that are not locally defined in their prototype. If this sounds abstract, you can think of prototypes as classes that you could create and manipulate just as other objects.
- Slot: a slot is an object part that allows to bind values to names. Slots can be considered as a name --> value mapping belonging to a particular object. Attributes and operations are first resolved in an object slot. For Pythonistas, a slot is the equivalent of an entry in a hash table.
- Actor: First introduced by Carl Hewitt in his PLANNER paper of 1969, the concept of an actor is equivalent to an active object (thread) that would asynchronously process received messages (like operations). In Gul Agha actor model, messages are first queued in a FIFO attached to the object, and then sequentially processed. Actors are sometimes refered to as active objects, and even agents, though the use of this term is controversial.
- Asynchronous message: when an object (sender) sends a message to another object (receiver), the sender usually waits for the sender to receive the message, process it and send a response (indicating the message was processed, optionally with a return value). This is called synchronous communication, when sending is a blocking act for the sender. With asynchronous messages, the sender simply sends the message, but do not wait for the response, enable it to continue to act while the message is processed by the receiver.
- Future: also know as "promise" a Future is an encapsulation of the future response message (actually response value) to an asynchronous message. A future enables objects to reference a value that is not yet computed.
Note: Maybe also exlain continuation, scope, resolution, tag, typed and untyped, reflectivity, etc.
Recommendend readings:
- Reactive objects by Joan Nordlander
- http://lambda.weblogs.com Lambda the Ultimate
4. Io object model
Io is a purely object-oriented language, which means that everything is an object. Many object languages that derive from the C family are not able to manipulate primitive types (integers, floats, etc) consistently with object. Io has a single primitive: the Object. In this respect, the dynamic properties of objects are available for all entities in Io.
Definition of a message Prototype based Values, Primitives and Objects Mechanisms involved in responsing to a message Messaging model
Io has the very appreciable feature of accessing the object that sent a message to the receiving object. This allows to modify the behaviour of the receiving object according to the type of the invoking object. The sender object is accessible using the "sender" slot of the receiving object.
5. Understanding Io concepts
Io is based on some concepts that may not be familiar to people used to common programming languages such as C, C++ or Java. At first, Io is inspired by the following kinds of languages:
- Prototype-based language: languages that realise inheritance by cloning object rather than instanciating them from a class.
- Actor language: languages that consider objects to be dynamic and to communicate with messages
- Functional languages: languages that provide a lambda-like operator, either closure or blocks.
Don't be afraid if you don't know the languages or understand my short presentation, this will be explained here.
A. Types and Protoypes
Even if types and prototypes share the same "types" suffix, they both represent different things. A type qualifies and categories a given value, while a prototype is already a value.
Most programming languages allow to define new types ; in object-oriented programming, new types are defined with classes. Classes can be considered as a model that will be reproduced by the instances, the reproduction of the model is done by the class constructor operations. The main problem with classes is that they may not be referencable or accessible (if the language is not reflexive like C++, unlike Java), and that it is definitely not possible to modify them at runtime.
Prototypes allow to do the same as defining new types through classes: instead of describing a class, we construct an object that will serve as the actual model for future "instances". The equivalent operation to creating an instance is simply to "clone" the prototype. This language trait allow to freely manipulate prototype, which is not always possible with classes (though a fully reflexive non-prototype language would certainly exhibit the same features).
The idea behind prototypes (which could also be called "stereotype") is that you build a collection of predefined objects that will serve as a basis for all object that will be based on them. Prototype is a very interesting way to weave objets together.
A good thing would also be to have a look at this page http://www.wikipedia.org/wiki/Prototype_based.
B. Types and Tags
Tag in Io are inspired from Lua typing system [2], a tag specifies a given type. For instance, a Lua function could be either implemented in Lua or in C. To make the difference between both functions (which are considered as first-class language citizens, ie. values) the tag is used to indicate wether the function is in C or in Lua. Tags can then be considered as a sub-type.
Tags are useful for customising Io because they allow to extend or redefine the behaviour of a specific type, like for instance redefine how a list would react the add or remove messages.
Steve gives the following explaination on tags :
Every value is a primitive of some sort - a String, List, Objects, etc. And the data structure for each primitive begins with "mark" and "tag" members.
Example:
typedef struct { IoMark? mark; Tag *tag; ByteArray? *byteArray; } IoString?;
The mark is for garbage collection purposes and the tag is a reference the primitive's tag datastructure. The tag is used to figure out which C function to call for a given operation on a value. For example, when the garbage collector decides to free the IoString??, it ends up looking in the IoString??'s tag and finds the freeFunc function pointer and calls it. This function pointer is set to IoString?_free. The freeFunc function pointer in a tag for a different primitive would would be set to a different C function. This makes it easier for people to externally add new primitves.
Links:
- [2] See Lua 4.http://www.lua.org/manual/4.0/manual.html manual in sections 3 and 4, at http://www.lua.org/manual/4.0/manual.html. They provide a great
explaination on how tags can be used.
C. Reflectivity
Io is an intrinsically open language, as it offers very powerful reflexive features. One of the interesting features is that Io stores the whole program as a tree that mirrors the source code. This tree is not compiled to bytecode, but is rather directly executed.
One of the side effects of this choice is that you can get the source code at anytime. For instance, any Io object can output its source code. This is a truely interesting feature from an open-source development perspective, which recalls me the power of categories in Objective-C.
D. Language constructs reification
The combination of tags and reflexivity grants Io with very powerful self-modifications features, such as redefining the behaviour of executing a block value. Here is a Io code snippet that substitutes the default block activation function with a new one:
IoTag? *tag = IoState?_tagWithInitFunction_(ioState, StateTagInit?*)IoBlock?_initTagWithId_); tag->activationFunc = MyBlockActivationFunc?;
then in the activation function, you can do what you want:
IoValue? * MyBlockActivationFunc?(IoBlock? *self, IoObject? *target, IoObject? *locals, IoMessage? *m) { /* Do what I want */ /* And call the normal IoBlock? activation function */ IoBlock?_target_locals_call_(self, target, locals, m); }
[ Note that this example was given by Steve on the Io mailing-list]
I'm not sure if this is the right term for qualifying this, but to me, language reification means that the language internal mechanism is reified so as to be able to reprogram the language with the language itself (or through the use of simple extensions in C).
See http://www.wikipedia.org/wiki/Dynamic_typing
Comments
Feel free to add comments on this document.
[http://www.casino-online-on-line.com] * [Online Casino | http://www.casino-online-on-line.com] * [Casino Online | http://www.casino-online-on-line.com] * [http://www.casino-online-on-line.com online casino] - games, internet casino, casino online casino, poker * [http://www.casino-online-on-line.com casino online] - games, internet casino, casino online casino, poker i want to play with sandbox... <a href="http://www.casino-online-on-line.com">online casino</a> it"s a very nice keyboard <a href="http://www.casino-online-on-line.com">casino online</a> the casino roulette as well <a href="http://www.casino-online-on-line.com">Internet Casino</a> sopranos is pretty exciting <a href="http://www.casino-online-on-line.com">Casino</a> money <a href="http://www.casino-online-on-line.com">online Poker</a> jesus christ <a href="http://www.casino-online-on-line.com">casino-online</a> with gir <a href="http://www.casino-online-on-line.com">online-casino</a> i would google family <a href="http://www.google.com">Google</a> about my alone gambling
write("Hello World\n")
write("Hello World\n")
Here is an Object-oriented "Hello World" written in Io:
Here's is a basic "Hello World" written in Io:
write("Hello World\n")
And here is an Object-oriented "Hello World" written in Io:
[=HelloObject? = Object clone HelloObject? sayHello = method(
[=HelloObject? := Object clone HelloObject? sayHello := method(
from a more theorical point of view and expose the traits (a.k.a. the
from a more theoretical point of view and expose the traits (a.k.a. the
- Message-oriented: all interactions in Io are made through messages, which are the equivalent of function and method calls in other languages. Messages are also reified into the languages, which allows to manipulate them as any other object.
- Strongly typed: all interactions are through messages to object. Memory is never accessed directly.
- Slot: a slot is an object part that allows to bind values to names. Slots can be considered as a name --> value mapping belonging to a particular object. Attributes and operations are first resolved in an object slot.
- Slot: a slot is an object part that allows to bind values to names. Slots can be considered as a name --> value mapping belonging to a particular object. Attributes and operations are first resolved in an object slot. For Pythonistas, a slot is the equivalent of an entry in a hash table.
- Actor: First introduced by Carl Hewitt in his PLANNER paper of 1969, the concept of an actor is equivalent to an active object (thread) that would asynchronously process received messages (like operations). In Gul Agha actor model, messages are first queued in a FIFO attached to the object, and sequentially processed.
- Actor: First introduced by Carl Hewitt in his PLANNER paper of 1969, the concept of an actor is equivalent to an active object (thread) that would asynchronously process received messages (like operations). In Gul Agha actor model, messages are first queued in a FIFO attached to the object, and then sequentially processed. Actors are sometimes refered to as active objects, and even agents, though the use of this term is controversial.
- Lambda the Ultimate
- http://lambda.weblogs.com Lambda the Ultimate
