Is anyone using it? Thanks to everyone that made contributions. Patches are still welcome. The latest alpha release is from Io has been around for a long time, indeed. I thought it was great, writing an Io interpreter in C was a lot easier than almost anything else, so for learning language internals, it is awesome, and I'd even say a great companion to LISP, to play around with how different first principles affect programming -- something that is obscured in mainstream languages, making it harder to learn how the guts work.
PedroBatista on April 7, prev next [—]. My graduation final project was done in Io more than a decade ago. The language is generally great but it needed some financial muscle on the implementation side as every language do, this stuff is hard.
It also has really bad SEO potential due to its name. Go managed to overcome the issue, but it had google on its side. The more I program, the less do I value any of these overly dynamic features and elegant aesthetics.
However, I have come to greatly value robust tooling surrounding a language, to the point where I believe designing a language that makes the creation of such tooling difficult or impossible is a terrible trade-off. Any examples? Does Io make such trade-off? Boring is good. If an object name starts with an uppercase letter, it is a Prototype.
If an object starts with a lowercase letter, it is an Instance. Instances are cloned from prototypes and store this prototype in a special type slot. This is somewhat similar to instances sharing a common class in an object-oriented language, but quite a bit looser.
Really this is just a convention that helps with certain design patterns. So porsche is an instance of Car, and it has no defined slots. This might not seem useful, but by the power of prototypal inheritance, porsche gets all the behaviors of Car, Vehicle, and Object.
In addition to normal slots, objects have a slot called Protos , which stores a List an array containing all of the prototypes the objects inherit state and behaviors from. Because this is a list, Io supports multiple inheritance, and the "prototypal inheritance chain" is actually not a chain, but a tree. When an object receives a message, it checks it's local slots for a match. If there isn't one, it triggers a depth first search searching ancestor prototypes for a match.
The first match found receives and processes the message. This logic for performing a depth first search lives in the forward method of the base Object prototype. The simple architecture of message passing and prototypal inheritance is quite powerful. In fact, just about the entire Io language is implemented as methods on prototypes. For example, the base Object prototype stores methods at the slots for and if , so branching and looping works via objects and message passing just like everything else.
This works because the global namespace of Io's execution environment is the Lobby object, which has Object in its prototype chain. The Lobby is the default target for messages when none are explicitly specified, which is how something like the following works:.
We've learned that messages are passed to objects and handled by matching slots, and that these slots can exist anywhere in the prototypal inheritance tree. Let's take a closer look at messages themselves. In fact, when we talk about messages, we are really talking about two things: the message and the call. In the context of mailing a letter, the message is like the letter.
It has "Dear John" indicating the name of the person that the message is for and the main content of the message the arguments. The call is like the envelope. It wraps the message and has an address and a return address to help the postman with delivery. Let's illustrate this by a simple example. KITT can talk via the method say, but what would the message have to look like for this to work?
Inside of the receiving method, the call and the wrapped message can be inspected as follows:. The second call we sent to KITT doesn't find a local drive slot, so it traverses the prototypal inheritance chain to the Car Prototype.
Given that calls and messages are just normal objects, they provide slots with states and methods. The examples above are just the basics, but the technique provides a powerful tool for message reflection without having to know advanced syntax. In Io, methods are anonymous functions that are stored at slots. They are defined by the method method , which exists as a slot on the base Object prototype.
Skip to content. Star 2. Io programming language. View license. Branches Tags. Could not load branches. Could not load tags. Latest commit.
Git stats 2, commits. Failed to load latest commit information. Bring back tests fixes. Jun 22, May 14, Remove sysctl.
Fix for issue Oct 11, Fixing clang format error.
0コメント