ToonTalk computer programming language
Encyclopedia
ToonTalk is a computer programming system intended to be programmed by children. The "Toon" part stands for cartoon. The system's presentation is in the form of animated characters, including robots that can be trained by example.
ToonTalk was influenced by the Janus computer programming language and the Actor model
. The main communication abstraction in ToonTalk is the bird/nest pair. When you (the programmer or a robot) give an object to a bird, she flies to her nest and puts the object in it, then returns. If one or more objects already occupy the nest, the bird puts the new one underneath the others.
A ToonTalk program is a sequence of rules, where each rule has a head and a tail. The head is a pattern that can be matched against the argument, which must be a tuple. In ToonTalk's presentation, a rule appears as a robot, a program as a team of robots, and a tuple as a box that can have any number of holes or compartments in which objects may be placed. The alphabet of objects includes number pads, text pads, other boxes, robot teams, birds, nests, etc., etc. ("Object" here does not mean in the object-oriented programming sense, but rather in the everyday sense where if I give you an object, I don't have it anymore). A process consists of a box with a team of robots working on it. If none of the patterns matches the box, the process suspends. Otherwise, the first rule that matches, fires. The end of the tail of the rule can either destroy the process, or continue it with the same team. In case the pattern calls for something other than an empty nest where an empty nest is present, the process suspends until some bird should place something on the nest (usually as a result of the actions of other processes). A nest with something on it matches the pattern as though the nest were not there, just the (top) something. The actions in the tail also manipulate the something rather than the whole nest. Consequently, a nest can be used to program a future
.
ToonTalk can be given an imperative reading or a declarative reading. If we ignore certain constructs designed to facilitate I/O, we can see ToonTalk as not having any shared access to mutable memory. The bird/nest mechanism resembles the communication in the Actor model
, but with the additional power to be able to pass nests around and for a process to hold more than one nest (which is also true in Janus). A difference between communication in the Actor model
and in ToonTalk is that ToonTalk preserves the order of the messages; however, ToonTalk can also provide an indeterministic merge of message streams.
ToonTalk was influenced by the Janus computer programming language and the Actor model
Actor model
In computer science, the Actor model is a mathematical model of concurrent computation that treats "actors" as the universal primitives of concurrent digital computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and...
. The main communication abstraction in ToonTalk is the bird/nest pair. When you (the programmer or a robot) give an object to a bird, she flies to her nest and puts the object in it, then returns. If one or more objects already occupy the nest, the bird puts the new one underneath the others.
A ToonTalk program is a sequence of rules, where each rule has a head and a tail. The head is a pattern that can be matched against the argument, which must be a tuple. In ToonTalk's presentation, a rule appears as a robot, a program as a team of robots, and a tuple as a box that can have any number of holes or compartments in which objects may be placed. The alphabet of objects includes number pads, text pads, other boxes, robot teams, birds, nests, etc., etc. ("Object" here does not mean in the object-oriented programming sense, but rather in the everyday sense where if I give you an object, I don't have it anymore). A process consists of a box with a team of robots working on it. If none of the patterns matches the box, the process suspends. Otherwise, the first rule that matches, fires. The end of the tail of the rule can either destroy the process, or continue it with the same team. In case the pattern calls for something other than an empty nest where an empty nest is present, the process suspends until some bird should place something on the nest (usually as a result of the actions of other processes). A nest with something on it matches the pattern as though the nest were not there, just the (top) something. The actions in the tail also manipulate the something rather than the whole nest. Consequently, a nest can be used to program a future
Future (programming)
In computer science, future, promise, and delay refer to constructs used for synchronization in some concurrent programming languages. They describe an object that acts as a proxy for a result that is initially not known, usually because the computation of its value has not yet completed.The term...
.
ToonTalk can be given an imperative reading or a declarative reading. If we ignore certain constructs designed to facilitate I/O, we can see ToonTalk as not having any shared access to mutable memory. The bird/nest mechanism resembles the communication in the Actor model
Actor model
In computer science, the Actor model is a mathematical model of concurrent computation that treats "actors" as the universal primitives of concurrent digital computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and...
, but with the additional power to be able to pass nests around and for a process to hold more than one nest (which is also true in Janus). A difference between communication in the Actor model
Actor model
In computer science, the Actor model is a mathematical model of concurrent computation that treats "actors" as the universal primitives of concurrent digital computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and...
and in ToonTalk is that ToonTalk preserves the order of the messages; however, ToonTalk can also provide an indeterministic merge of message streams.